diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2018-10-12 06:46:09 +0200 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2018-10-14 15:15:05 +0200 |
commit | b159aa5da7e1aa7abeb2f77ba644aa164d25a46d (patch) | |
tree | 49321b66d1e504b9c351cd6f4a99d08b804313ae /modules | |
parent | 8ef10eb646873b257e8e84fa140bff88d85f5496 (diff) | |
download | gnulib-b159aa5da7e1aa7abeb2f77ba644aa164d25a46d.tar.gz |
timevar: use gethrxtime to get wall clock time
clock_gettime is not portable. gethrxtime takes the best available
option to get the wall clock time, including clock_gettime (monotonic
clock), and gettime (non monotonic).
Also, using xtime_t instead of float preserves the precision.
Suggested by Bruno Haible.
* lib/xtime.h (xtime_make): Handle overflows of nanoseconds.
* modules/timevar (Depends-on): We need gethrxtime.
We no longer use times().
(Link): Update.
* lib/timevar.h (timevar_time_def): Use xtime_t.
* lib/timevar.c (set_to_current_time): Use gethrxtime.
(timevar_print): Instead of checking whether the timings themselves
are large enough for the timevar to be printed, check the percentages.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/timevar | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/timevar b/modules/timevar index 354d1d211f..b2a12bb992 100644 --- a/modules/timevar +++ b/modules/timevar @@ -6,12 +6,12 @@ lib/timevar.h lib/timevar.c Depends-on: +gethrxtime getrusage gettext-h stdlib sys_time sys_times -times xalloc Makefile.am: @@ -20,6 +20,10 @@ lib_SOURCES += timevar.c timevar.def Include: "timevar.h" +Link: +$(LIB_GETHRXTIME) +$(LTLIBINTL) when linking with libtool, $(LIBINTL) otherwise + License: GPLv3+ |