mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 08:32:45 +00:00
pimd: Add the ability to get time in usec
Add ability to return a int64_t time in usec. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
e5905a3bc3
commit
8a9bd91cd9
@ -83,6 +83,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;
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
int64_t pim_time_monotonic_sec(void);
|
||||
int64_t pim_time_monotonic_dsec(void);
|
||||
int64_t pim_time_monotonic_usec(void);
|
||||
int pim_time_mmss(char *buf, int buf_size, long sec);
|
||||
void pim_time_timer_to_mmss(char *buf, int buf_size, struct thread *t);
|
||||
void pim_time_timer_to_hhmmss(char *buf, int buf_size, struct thread *t);
|
||||
|
Loading…
Reference in New Issue
Block a user