summaryrefslogtreecommitdiff
path: root/pimd/pim_time.c
diff options
context:
space:
mode:
Diffstat (limited to 'pimd/pim_time.c')
-rw-r--r--pimd/pim_time.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/pimd/pim_time.c b/pimd/pim_time.c
index 75f767fef1..348793cd0b 100644
--- a/pimd/pim_time.c
+++ b/pimd/pim_time.c
@@ -82,6 +82,25 @@ int64_t pim_time_monotonic_dsec()
return now_dsec;
}
+int64_t
+pim_time_monotonic_usec (void)
+{
+ struct timeval now_tv;
+ int64_t now_dsec;
+
+ if (gettime_monotonic(&now_tv)) {
+ zlog_err("%s: gettime_monotonic() failure: errno=%d: %s",
+ __PRETTY_FUNCTION__,
+ errno, safe_strerror(errno));
+ return -1;
+ }
+
+ now_dsec = ((int64_t) now_tv.tv_sec) * 1000000 + ((int64_t) now_tv.tv_usec);
+
+ return now_dsec;
+
+}
+
int pim_time_mmss(char *buf, int buf_size, long sec)
{
long mm;