>This fanction will provide monotonic time in microseconds. [BHANU] Typo here with function.
> >Signed-off-by: Ilya Maximets <[email protected]> >--- > lib/timeval.c | 22 ++++++++++++++++++++++ lib/timeval.h | 2 ++ > 2 files changed, 24 insertions(+) > >diff --git a/lib/timeval.c b/lib/timeval.c index dd63f03..be2eddc 100644 >--- a/lib/timeval.c >+++ b/lib/timeval.c >@@ -233,6 +233,22 @@ time_wall_msec(void) > return time_msec__(&wall_clock); > } > >+static long long int >+time_usec__(struct clock *c) >+{ >+ struct timespec ts; >+ >+ time_timespec__(c, &ts); >+ return timespec_to_usec(&ts); >+} >+ >+/* Returns a monotonic timer, in microseconds. */ long long int >+time_usec(void) >+{ >+ return time_usec__(&monotonic_clock); } >+ [BHANU] As you are introducing the support for microsecond granularity, can you also add time_wall_usec() and time_wall_usec__() here? The ipfix code (ipfix_now()) can be the first one to use it for now. May be more in the future! > /* Configures the program to die with SIGALRM 'secs' seconds from now, if > * 'secs' is nonzero, or disables the feature if 'secs' is zero. */ void @@ > -360,6 >+376,12 @@ timeval_to_msec(const struct timeval *tv) > return (long long int) tv->tv_sec * 1000 + tv->tv_usec / 1000; } > >+long long int >+timespec_to_usec(const struct timespec *ts) { >+ return (long long int) ts->tv_sec * 1000 * 1000 + ts->tv_nsec / >+1000; } >+ [BHANU] how about adding timeval_to_usec()? Also it would be nice to have the usec_to_timespec() and timeval_diff_usec() implemented to make this commit complete. - Bhanuprakash. _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
