summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System/Win32/TimeValue.cpp
diff options
context:
space:
mode:
authorJeff Cohen <jeffc@jolt-lang.org>2004-12-14 05:26:43 +0000
committerJeff Cohen <jeffc@jolt-lang.org>2004-12-14 05:26:43 +0000
commit2b60d39499d9ac3e5078f4a134c3fd80b46e2b94 (patch)
tree08e629779ada65207416df8c7d40ee421ef8d6e9 /llvm/lib/System/Win32/TimeValue.cpp
parenteedafda7bb5fdb6b77aab15482c9fc6c3f1a59a9 (diff)
downloadbcm5719-llvm-2b60d39499d9ac3e5078f4a134c3fd80b46e2b94.tar.gz
bcm5719-llvm-2b60d39499d9ac3e5078f4a134c3fd80b46e2b94.zip
Implement Win32 Path::getStatusInfo(), TimeValue::toString()
llvm-svn: 18930
Diffstat (limited to 'llvm/lib/System/Win32/TimeValue.cpp')
-rw-r--r--llvm/lib/System/Win32/TimeValue.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/llvm/lib/System/Win32/TimeValue.cpp b/llvm/lib/System/Win32/TimeValue.cpp
index eab776fc17f..f45662948bc 100644
--- a/llvm/lib/System/Win32/TimeValue.cpp
+++ b/llvm/lib/System/Win32/TimeValue.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "Win32.h"
+#include <time.h>
namespace llvm {
using namespace sys;
@@ -21,17 +22,22 @@ using namespace sys;
//===----------------------------------------------------------------------===//
TimeValue TimeValue::now() {
- __int64 ft;
+ uint64_t ft;
GetSystemTimeAsFileTime(reinterpret_cast<FILETIME *>(&ft));
- return TimeValue(
- static_cast<TimeValue::SecondsType>( ft / 10000000 +
- Win32ZeroTime.seconds_ ),
- static_cast<TimeValue::NanoSecondsType>( (ft % 10000000) * 100) );
+ TimeValue t(0, 0);
+ t.fromWin32Time(ft);
+ return t;
}
std::string TimeValue::toString() const {
- return "Don't know how to conver time on Win32";
+ // Alas, asctime is not re-entrant on Windows...
+
+ __time64_t ourTime = this->toEpochTime();
+ char* buffer = ::asctime(::_localtime64(&ourTime));
+
+ std::string result(buffer);
+ return result.substr(0,24);
}
// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
OpenPOWER on IntegriCloud