Reid Spencer | 0d5716e | 2004-09-25 05:03:54 +0000 | [diff] [blame] | 1 | //===- Win32/TimeValue.cpp - Win32 TimeValue Implementation -----*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Reid Spencer | 10366a4 | 2004-09-28 23:56:20 +0000 | [diff] [blame^] | 5 | // This file was developed by Jeff Cohen and is distributed under the |
Reid Spencer | 0d5716e | 2004-09-25 05:03:54 +0000 | [diff] [blame] | 6 | // University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file provides the Win32 specific implementation of the TimeValue class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Reid Spencer | 10366a4 | 2004-09-28 23:56:20 +0000 | [diff] [blame^] | 14 | #include "Win32.h" |
Reid Spencer | 0d5716e | 2004-09-25 05:03:54 +0000 | [diff] [blame] | 15 | |
| 16 | namespace llvm { |
| 17 | using namespace sys; |
| 18 | |
| 19 | //===----------------------------------------------------------------------===// |
Reid Spencer | 10366a4 | 2004-09-28 23:56:20 +0000 | [diff] [blame^] | 20 | //=== WARNING: Implementation here must contain only Win32 specific code. |
Reid Spencer | 0d5716e | 2004-09-25 05:03:54 +0000 | [diff] [blame] | 21 | //===----------------------------------------------------------------------===// |
| 22 | |
Reid Spencer | 10366a4 | 2004-09-28 23:56:20 +0000 | [diff] [blame^] | 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 | } |
Reid Spencer | 0d5716e | 2004-09-25 05:03:54 +0000 | [diff] [blame] | 32 | |
| 33 | // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab |
| 34 | |
| 35 | } |