[PATCH] ntdll: Fix existing conftests for nanosecond precision time fields.
Charles Davis
cdavis5x at gmail.com
Thu Nov 29 04:46:33 CST 2012
From: Charles Davis <cdavis at mymail.mines.edu>
Autoconf checks for a field of a struct by using it in an if()
expression. Of course, you can't do this for an aggregate field, so you
must instead check a field of that aggregate instead. Up until now, the
conftests for the st_?tim fields were all failing, even on systems that
had them, because of this.
---
configure.ac | 2 +-
dlls/ntdll/file.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8e6a70f..e974b15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2269,7 +2269,7 @@ AC_CHECK_MEMBERS([struct option.name],,,
#endif])
dnl Check for stat.st_blocks and ns-resolved times
-AC_CHECK_MEMBERS([struct stat.st_blocks,struct stat.st_mtim,struct stat.st_ctim,struct stat.st_atim])
+AC_CHECK_MEMBERS([struct stat.st_blocks,struct stat.st_mtim.tv_nsec,struct stat.st_ctim.tv_nsec,struct stat.st_atim.tv_nsec])
dnl Check for sin6_scope_id
AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index da5be8e..389bef8 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1592,10 +1592,10 @@ static NTSTATUS set_file_times( int fd, const LARGE_INTEGER *mtime, const LARGE_
{
tv[0].tv_sec = st.st_atime;
tv[1].tv_sec = st.st_mtime;
-#ifdef HAVE_STRUCT_STAT_ST_ATIM
+#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
tv[0].tv_usec = st.st_atim.tv_nsec / 1000;
#endif
-#ifdef HAVE_STRUCT_STAT_ST_MTIM
+#ifdef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
tv[1].tv_usec = st.st_mtim.tv_nsec / 1000;
#endif
}
@@ -1629,13 +1629,13 @@ static inline void get_file_times( const struct stat *st, LARGE_INTEGER *mtime,
RtlSecondsSince1970ToTime( st->st_mtime, mtime );
RtlSecondsSince1970ToTime( st->st_ctime, ctime );
RtlSecondsSince1970ToTime( st->st_atime, atime );
-#ifdef HAVE_STRUCT_STAT_ST_MTIM
+#ifdef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
mtime->QuadPart += st->st_mtim.tv_nsec / 100;
#endif
-#ifdef HAVE_STRUCT_STAT_ST_CTIM
+#ifdef HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC
ctime->QuadPart += st->st_ctim.tv_nsec / 100;
#endif
-#ifdef HAVE_STRUCT_STAT_ST_ATIM
+#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
atime->QuadPart += st->st_atim.tv_nsec / 100;
#endif
*creation = *mtime;
--
1.7.12.4
More information about the wine-patches
mailing list