Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
dbwiddis committed Nov 30, 2015
1 parent a534da0 commit 3d96282
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,9 @@ public void testGetSystemTimes() {
WinBase.FILETIME lpUserTime = new WinBase.FILETIME();
boolean succ = kernel.GetSystemTimes(lpIdleTime, lpKernelTime, lpUserTime);
assertTrue(succ);
// WinBase.FILETIME toLong() converts 100-ns since 1/1/1601 to ms since
// 1/1/1970. If this behavior is changed, remove the below conversions
// See https://github.com/java-native-access/jna/issues/546
long EPOCH_DIFF = 11644473600000L;
long idle = (lpIdleTime.toLong() + EPOCH_DIFF) * 10;
long kernel = (lpKernelTime.toLong() + EPOCH_DIFF) * 10;
long user = (lpUserTime.toLong() + EPOCH_DIFF) * 10;
long idleTime = WinBase.FILETIME.dateToFileTime(lpIdleTime.toDate());
long kernelTime = WinBase.FILETIME.dateToFileTime(lpKernelTime.toDate());
long userTime = WinBase.FILETIME.dateToFileTime(lpUserTime.toDate());
// All should be >= 0. kernel includes idle.
assertTrue(idle >= 0);
assertTrue(kernel >= idle);
Expand Down

0 comments on commit 3d96282

Please sign in to comment.