aboutsummaryrefslogtreecommitdiff
path: root/lib/System/Win32/TimeValue.cpp
blob: 7ec2b395485e14ead4fde4e7dff1f394a9b2ccb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//===- Win32/TimeValue.cpp - Win32 TimeValue Implementation -----*- C++ -*-===//
// 
//                     The LLVM Compiler Infrastructure
//
// This file was developed by Jeff Cohen and is distributed under the 
// University of Illinois Open Source License. See LICENSE.TXT for details.
// 
//===----------------------------------------------------------------------===//
//
// This file provides the Win32 specific implementation of the TimeValue class.
//
//===----------------------------------------------------------------------===//

#include "Win32.h"

namespace llvm {
using namespace sys;

//===----------------------------------------------------------------------===//
//=== WARNING: Implementation here must contain only Win32 specific code.
//===----------------------------------------------------------------------===//

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

}