mirror of
https://github.com/corda/corda.git
synced 2025-01-20 03:36:29 +00:00
fix windows.cpp MySystem::now
This commit is contained in:
parent
6cf3666ed9
commit
75de0a621b
@ -769,24 +769,13 @@ class MySystem: public System {
|
||||
}
|
||||
|
||||
virtual int64_t now() {
|
||||
static LARGE_INTEGER frequency;
|
||||
static LARGE_INTEGER time;
|
||||
static bool init = true;
|
||||
|
||||
if (init) {
|
||||
QueryPerformanceFrequency(&frequency);
|
||||
|
||||
if (frequency.QuadPart == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
init = false;
|
||||
}
|
||||
|
||||
QueryPerformanceCounter(&time);
|
||||
return static_cast<int64_t>
|
||||
(((static_cast<double>(time.QuadPart)) * 1000.0) /
|
||||
(static_cast<double>(frequency.QuadPart)));
|
||||
// We used to use _ftime here, but that only gives us 1-second
|
||||
// resolution on Windows 7. _ftime_s might work better, but MinGW
|
||||
// doesn't have it as of this writing. So we use this mess instead:
|
||||
FILETIME time;
|
||||
GetSystemTimeAsFileTime(&time);
|
||||
return (((static_cast<int64_t>(time.dwHighDateTime) << 32)
|
||||
| time.dwLowDateTime) / 10000) - 11644473600000LL;
|
||||
}
|
||||
|
||||
virtual void exit(int code) {
|
||||
|
@ -205,6 +205,6 @@ public class Misc {
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(java.util.Calendar.getInstance().toString());
|
||||
System.out.println(new java.util.Date().toString());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user