[llvm] r186374 - Fix TimeValue::toWin32Time() to be symmetric to fromWin32Time() and compatible to Win32's FILETIME.

NAKAMURA Takumi geek4civic at gmail.com
Mon Jul 15 19:43:51 PDT 2013


Author: chapuni
Date: Mon Jul 15 21:43:51 2013
New Revision: 186374

URL: http://llvm.org/viewvc/llvm-project?rev=186374&view=rev
Log:
Fix TimeValue::toWin32Time() to be symmetric to fromWin32Time() and compatible to Win32's FILETIME.

llvm-ar is the only user of toWin32Time() (via setLastModificationAndAccessTime), and r186298 can be reverted.
It had been buggy since the initial commit.

FIXME: Could we rename {from|to}Win32Time as {from|to}Win32FILETIME in TimeValue?

Modified:
    llvm/trunk/include/llvm/Support/TimeValue.h
    llvm/trunk/test/Object/extract.ll

Modified: llvm/trunk/include/llvm/Support/TimeValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TimeValue.h?rev=186374&r1=186373&r2=186374&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/TimeValue.h (original)
+++ llvm/trunk/include/llvm/Support/TimeValue.h Mon Jul 15 21:43:51 2013
@@ -253,9 +253,10 @@ namespace sys {
 
     /// Converts the TimeValue into the corresponding number of "ticks" for
     /// Win32 platforms, correcting for the difference in Win32 zero time.
-    /// @brief Convert to windows time (seconds since 12:00:00a Jan 1, 1601)
+    /// @brief Convert to Win32's FILETIME
+    /// (100ns intervals since 00:00:00 Jan 1, 1601 UTC)
     uint64_t toWin32Time() const {
-      uint64_t result = seconds_ - Win32ZeroTimeSeconds;
+      uint64_t result = (uint64_t)10000000 * (seconds_ - Win32ZeroTimeSeconds);
       result += nanos_ / NANOSECONDS_PER_WIN32_TICK;
       return result;
     }

Modified: llvm/trunk/test/Object/extract.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/extract.ll?rev=186374&r1=186373&r2=186374&view=diff
==============================================================================
--- llvm/trunk/test/Object/extract.ll (original)
+++ llvm/trunk/test/Object/extract.ll Mon Jul 15 21:43:51 2013
@@ -3,9 +3,6 @@
 ; This test just makes sure that llvm-ar can extract bytecode members
 ; from various style archives.
 
-; FIXME: Investigate Win32's TimeValue stuff!
-; XFAIL: mingw32
-
 ; REQUIRES: shell
 
 ; RUN: cd %T





More information about the llvm-commits mailing list