This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgMax has submitted this change and it was merged. Change subject: Add time conversion helpers ...................................................................... Add time conversion helpers Add macros to break down absolute time in seconds into days/hours/minutes passed. Change-Id: I46b9a405c18ed9da8f31b7d5b6dcece5468bafbf --- M include/osmocom/core/timer.h 1 file changed, 5 insertions(+), 0 deletions(-) Approvals: Pau Espin Pedrol: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/core/timer.h b/include/osmocom/core/timer.h index 40b39b9..4958efb 100644 --- a/include/osmocom/core/timer.h +++ b/include/osmocom/core/timer.h @@ -45,6 +45,11 @@ #include <osmocom/core/linuxlist.h> #include <osmocom/core/linuxrbtree.h> +/* convert absolute time (in seconds) to elapsed days/hours/minutes */ +#define OSMO_SEC2MIN(sec) ((sec % (60 * 60)) / 60) +#define OSMO_SEC2HRS(sec) ((sec % (60 * 60 * 24)) / (60 * 60)) +#define OSMO_SEC2DAY(sec) ((sec % (60 * 60 * 24 * 365)) / (60 * 60 * 24)) /* we ignore leap year for simplicity */ + /*! A structure representing a single instance of a timer */ struct osmo_timer_list { struct rb_node node; /*!< rb-tree node header */ -- To view, visit https://gerrit.osmocom.org/4060 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I46b9a405c18ed9da8f31b7d5b6dcece5468bafbf Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>