summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/core/timer.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/osmocom/core/timer.h b/include/osmocom/core/timer.h
index 40b39b90..4958efb3 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 */