[llvm-commits] CVS: llvm/lib/System/Win32/TimeValue.cpp

Reid Spencer reid at x10sys.com
Tue Sep 28 16:56:30 PDT 2004



Changes in directory llvm/lib/System/Win32:

TimeValue.cpp updated: 1.1 -> 1.2
---
Log message:

Win32 implementation of TimeValue::now().

Patch contributed by Jeff Cohen. Thanks Jeff!


---
Diffs of the changes:  (+12 -6)

Index: llvm/lib/System/Win32/TimeValue.cpp
diff -u llvm/lib/System/Win32/TimeValue.cpp:1.1 llvm/lib/System/Win32/TimeValue.cpp:1.2
--- llvm/lib/System/Win32/TimeValue.cpp:1.1	Sat Sep 25 00:03:54 2004
+++ llvm/lib/System/Win32/TimeValue.cpp	Tue Sep 28 18:56:20 2004
@@ -2,7 +2,7 @@
 // 
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by Reid Spencer and is distributed under the 
+// This file was developed by Jeff Cohen and is distributed under the 
 // University of Illinois Open Source License. See LICENSE.TXT for details.
 // 
 //===----------------------------------------------------------------------===//
@@ -11,18 +11,24 @@
 //
 //===----------------------------------------------------------------------===//
 
-// Include the generic Unix implementation
-#include "../Unix/Unix.h"
+#include "Win32.h"
 
 namespace llvm {
 using namespace sys;
 
 //===----------------------------------------------------------------------===//
-//=== WARNING: Implementation here must contain only Win32 specific code 
-//===          and must not be generic UNIX code (see ../Unix/TimeValue.cpp)
+//=== WARNING: Implementation here must contain only Win32 specific code.
 //===----------------------------------------------------------------------===//
 
-// FIXME: Need TimeValue::now()
+TimeValue TimeValue::now() {
+  __int64 ft;
+  GetSystemTimeAsFileTime(reinterpret_cast<FILETIME *>(&ft));
+
+  return TimeValue(
+    static_cast<TimeValue::SecondsType>( ft / 10000000 +
+      Win32ZeroTime.seconds_ ),
+    static_cast<TimeValue::NanoSecondsType>( (ft % 10000000) * 100) );
+}
 
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
 






More information about the llvm-commits mailing list