Erich Hoover : ntdll: Implement nanosecond precision file time storage.

Alexandre Julliard julliard at winehq.org
Tue Oct 30 13:27:36 CDT 2012


Module: wine
Branch: master
Commit: 5c95bec8478fe64611d86ed8f376e906329588bb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5c95bec8478fe64611d86ed8f376e906329588bb

Author: Erich Hoover <ehoover at mines.edu>
Date:   Thu Oct 25 17:52:25 2012 -0600

ntdll: Implement nanosecond precision file time storage.

---

 configure           |    1 +
 configure.ac        |    1 +
 dlls/ntdll/file.c   |   19 ++++++++++++++++++-
 include/config.h.in |    3 +++
 4 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index a736a5f..65c18a5 100755
--- a/configure
+++ b/configure
@@ -13012,6 +13012,7 @@ for ac_func in \
 	fstatfs \
 	fstatvfs \
 	ftruncate \
+	futimens \
 	futimes \
 	futimesat \
 	getattrlist \
diff --git a/configure.ac b/configure.ac
index d5d99f0..10e2fda 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2014,6 +2014,7 @@ AC_CHECK_FUNCS(\
 	fstatfs \
 	fstatvfs \
 	ftruncate \
+	futimens \
 	futimes \
 	futimesat \
 	getattrlist \
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 61ed576..234ed7e 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1562,7 +1562,24 @@ static NTSTATUS set_file_times( int fd, const LARGE_INTEGER *mtime, const LARGE_
 {
     NTSTATUS status = STATUS_SUCCESS;
 
-#if defined(HAVE_FUTIMES) || defined(HAVE_FUTIMESAT)
+#ifdef HAVE_FUTIMENS
+    struct timespec tv[2];
+
+    tv[0].tv_sec = tv[1].tv_sec = 0;
+    tv[0].tv_nsec = tv[1].tv_nsec = UTIME_OMIT;
+    if (atime->QuadPart)
+    {
+        tv[0].tv_sec = atime->QuadPart / 10000000 - SECS_1601_TO_1970;
+        tv[0].tv_nsec = (atime->QuadPart % 10000000) * 100;
+    }
+    if (mtime->QuadPart)
+    {
+        tv[1].tv_sec = mtime->QuadPart / 10000000 - SECS_1601_TO_1970;
+        tv[1].tv_nsec = (mtime->QuadPart % 10000000) * 100;
+    }
+    if (futimens( fd, tv ) == -1) status = FILE_GetNtStatus();
+
+#elif defined(HAVE_FUTIMES) || defined(HAVE_FUTIMESAT)
     struct timeval tv[2];
     struct stat st;
 
diff --git a/include/config.h.in b/include/config.h.in
index 39f1ec2..8dc812b 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -179,6 +179,9 @@
 /* Define to 1 if the system has the type `FT_TrueTypeEngineType'. */
 #undef HAVE_FT_TRUETYPEENGINETYPE
 
+/* Define to 1 if you have the `futimens' function. */
+#undef HAVE_FUTIMENS
+
 /* Define to 1 if you have the `futimes' function. */
 #undef HAVE_FUTIMES
 




More information about the wine-cvs mailing list