summaryrefslogtreecommitdiff
path: root/lib/sys_stat.in.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2017-05-13 02:51:05 +0200
committerBruno Haible <bruno@clisp.org>2017-05-13 02:51:54 +0200
commit7d2f35f7f976cc29baf22fd0d4d1d58fc870ce64 (patch)
tree5dc742225bf9ac0b554ff0dbd64e6ced0ea748ef /lib/sys_stat.in.h
parent44fe2082cf3e604bf0b4fe7259d1edb7cce334da (diff)
downloadgnulib-7d2f35f7f976cc29baf22fd0d4d1d58fc870ce64.tar.gz
windows-stat-timespec: New module.
* modules/windows-stat-timespec: New file. * m4/windows-stat-timespec.m4: New file. * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Set WINDOWS_STAT_TIMESPEC. * modules/sys_stat (Makefile.am): Substitute WINDOWS_STAT_TIMESPEC. * lib/sys_stat.in.h (struct stat) [WINDOWS_STAT_TIMESPEC]: Declare with fields st_atim, st_mtim, st_ctim. (st_atime, st_mtime, st_ctime): Define as macros. (_GL_WINDOWS_STAT_TIMESPEC): New macro. * lib/stat-w32.h (_gl_convert_FILETIME_to_timespec) [_GL_WINDOWS_STAT_TIMESPEC]: New declaration. * lib/stat-w32.c (_gl_convert_FILETIME_to_timespec) [_GL_WINDOWS_STAT_TIMESPEC]: New function. (_gl_convert_FILETIME_to_POSIX): Adjust coding style. (_gl_fstat_by_handle): If _GL_WINDOWS_STAT_TIMESPEC, convert the FILETIME to 'struct timespec', not 'time_t'. * lib/stat.c (rpl_stat): If _GL_WINDOWS_STAT_TIMESPEC, convert the FILETIME to 'struct timespec', not 'time_t'. * lib/stat-time.h (STAT_TIMESPEC): Define also if _GL_WINDOWS_STAT_TIMESPEC. * doc/windows-stat-timespec.texi: New file. * doc/gnulib.texi: Include it.
Diffstat (limited to 'lib/sys_stat.in.h')
-rw-r--r--lib/sys_stat.in.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index ef689b984f..24d08068fa 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -108,7 +108,7 @@ struct stat
blkcnt_t st_blocks;
# endif
-# if 0
+# if @WINDOWS_STAT_TIMESPEC@
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
@@ -118,10 +118,12 @@ struct stat
time_t st_ctime;
# endif
};
-# if 0
+# if @WINDOWS_STAT_TIMESPEC@
# define st_atime st_atim.tv_sec
# define st_mtime st_mtim.tv_sec
# define st_ctime st_ctim.tv_sec
+ /* Indicator, for gnulib internal purposes. */
+# define _GL_WINDOWS_STAT_TIMESPEC 1
# endif
# define GNULIB_defined_struct_stat 1
# endif