diff options
author | Bruno Haible <bruno@clisp.org> | 2017-05-11 21:38:28 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2017-05-11 21:39:06 +0200 |
commit | 055746f501699057db7ec353e19778064da5e084 (patch) | |
tree | 388cb8a72152f9ab5ba0ab166de43351a7d8cd25 /m4/gettimeofday.m4 | |
parent | 8898223d74820470c756fa6c15a2f0a397c51895 (diff) | |
download | gnulib-055746f501699057db7ec353e19778064da5e084.tar.gz |
gettimeofday: Increase precision on mingw.
* m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): Require AC_CANONICAL_HOST.
Set REPLACE_GETTIMEOFDAY to 1 on mingw.
* lib/gettimeofday.c (gettimeofday): On native Windows, use the
GetSystemTimePreciseAsFileTime based implementation always.
* doc/posix-functions/gettimeofday.texi: Mention precision problem on
mingw.
Diffstat (limited to 'm4/gettimeofday.m4')
-rw-r--r-- | m4/gettimeofday.m4 | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/m4/gettimeofday.m4 b/m4/gettimeofday.m4 index 34adc64778..8ee206eea2 100644 --- a/m4/gettimeofday.m4 +++ b/m4/gettimeofday.m4 @@ -1,4 +1,4 @@ -# serial 22 +# serial 23 # Copyright (C) 2001-2003, 2005, 2007, 2009-2017 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -9,9 +9,10 @@ dnl From Jim Meyering. AC_DEFUN([gl_FUNC_GETTIMEOFDAY], [ + AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) AC_REQUIRE([AC_C_RESTRICT]) + AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_HEADER_SYS_TIME_H]) - AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([gettimeofday]) gl_gettimeofday_timezone=void @@ -54,6 +55,11 @@ int gettimeofday (struct timeval *restrict, struct timezone *restrict); if test $REPLACE_STRUCT_TIMEVAL = 1; then REPLACE_GETTIMEOFDAY=1 fi + dnl On mingw, the original gettimeofday has only a precision of 15.6 + dnl milliseconds. So override it. + case "$host_os" in + mingw*) REPLACE_GETTIMEOFDAY=1 ;; + esac fi AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone], [Define this to 'void' or 'struct timezone' to match the system's |