Dynamic Library abstraction. This makes the abstraction of a single dynamic
[oota-llvm.git] / lib / System / Win32 / TimeValue.inc
1 //===- Win32/TimeValue.cpp - Win32 TimeValue Implementation -----*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by Jeff Cohen and is distributed under the 
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This file provides the Win32 implementation of the TimeValue class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "Win32.h"
15
16 namespace llvm {
17 using namespace sys;
18
19 //===----------------------------------------------------------------------===//
20 //=== WARNING: Implementation here must contain only Win32 specific code.
21 //===----------------------------------------------------------------------===//
22
23 TimeValue TimeValue::now() {
24   __int64 ft;
25   GetSystemTimeAsFileTime(reinterpret_cast<FILETIME *>(&ft));
26
27   return TimeValue(
28     static_cast<TimeValue::SecondsType>( ft / 10000000 +
29       Win32ZeroTime.seconds_ ),
30     static_cast<TimeValue::NanoSecondsType>( (ft % 10000000) * 100) );
31 }
32
33 std::string TimeValue::toString() const {
34   return "Don't know how to conver time on Win32";
35 }
36
37 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
38
39 }