equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
837 jlong windows_to_java_time(FILETIME wt) { |
837 jlong windows_to_java_time(FILETIME wt) { |
838 jlong a = jlong_from(wt.dwHighDateTime, wt.dwLowDateTime); |
838 jlong a = jlong_from(wt.dwHighDateTime, wt.dwLowDateTime); |
839 return (a - offset()) / 10000; |
839 return (a - offset()) / 10000; |
840 } |
840 } |
841 |
841 |
|
842 // Returns time ticks in (10th of micro seconds) |
|
843 jlong windows_to_time_ticks(FILETIME wt) { |
|
844 jlong a = jlong_from(wt.dwHighDateTime, wt.dwLowDateTime); |
|
845 return (a - offset()); |
|
846 } |
|
847 |
842 FILETIME java_to_windows_time(jlong l) { |
848 FILETIME java_to_windows_time(jlong l) { |
843 jlong a = (l * 10000) + offset(); |
849 jlong a = (l * 10000) + offset(); |
844 FILETIME result; |
850 FILETIME result; |
845 result.dwHighDateTime = high(a); |
851 result.dwHighDateTime = high(a); |
846 result.dwLowDateTime = low(a); |
852 result.dwLowDateTime = low(a); |
870 } else { |
876 } else { |
871 FILETIME wt; |
877 FILETIME wt; |
872 GetSystemTimeAsFileTime(&wt); |
878 GetSystemTimeAsFileTime(&wt); |
873 return windows_to_java_time(wt); |
879 return windows_to_java_time(wt); |
874 } |
880 } |
|
881 } |
|
882 |
|
883 void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) { |
|
884 FILETIME wt; |
|
885 GetSystemTimeAsFileTime(&wt); |
|
886 jlong ticks = windows_to_time_ticks(wt); // 10th of micros |
|
887 jlong secs = jlong(ticks / 10000000); // 10000 * 1000 |
|
888 seconds = secs; |
|
889 nanos = jlong(ticks - (secs*10000000)) * 100; |
875 } |
890 } |
876 |
891 |
877 jlong os::javaTimeNanos() { |
892 jlong os::javaTimeNanos() { |
878 if (!win32::_has_performance_count) { |
893 if (!win32::_has_performance_count) { |
879 return javaTimeMillis() * NANOSECS_PER_MILLISEC; // the best we can do. |
894 return javaTimeMillis() * NANOSECS_PER_MILLISEC; // the best we can do. |