diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-01-27 11:44:42 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-01-27 11:44:42 -0500 |
| commit | c016b6c796fe3a8520fdd0f30ef377cbb73e0037 (patch) | |
| tree | 78c3b29b41860c367390bba20a4a4d16fbaf3469 /pimd/pim_time.c | |
| parent | 75688c44d98af271ca4eb4f3133ede9e7ae709bb (diff) | |
| parent | aceb2285dad63dca7bba7177012aabdb63e1cca5 (diff) | |
Merge remote-tracking branch 'origin/master' into pr/111
Diffstat (limited to 'pimd/pim_time.c')
| -rw-r--r-- | pimd/pim_time.c | 19 |
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; |
