Changeset 52822 in vbox for trunk/src/VBox
- Timestamp:
- Sep 23, 2014 10:25:34 AM (10 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp
r48935 r52822 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 68 68 RTDECL(uint64_t) RTTimeMilliTS(void) 69 69 { 70 return rtTimeGetSystemNanoTS() / 1000000;70 return rtTimeGetSystemNanoTS() / RT_NS_1MS; 71 71 } 72 72 … … 80 80 RTDECL(uint64_t) RTTimeSystemMilliTS(void) 81 81 { 82 return rtTimeGetSystemNanoTS() / 1000000;82 return rtTimeGetSystemNanoTS() / RT_NS_1MS; 83 83 } 84 84 … … 94 94 #endif 95 95 clock_get_calendar_nanotime(&uSecs, &uNanosecs); 96 return RTTimeSpecSetNano(pTime, (uint64_t)uSecs * 1000000000+ uNanosecs);96 return RTTimeSpecSetNano(pTime, (uint64_t)uSecs * RT_NS_1SEC + uNanosecs); 97 97 } 98 98 -
trunk/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c
r18972 r52822 43 43 struct timespec tsp; 44 44 nanouptime(&tsp); 45 return tsp.tv_sec * UINT64_C(1000000000)45 return tsp.tv_sec * RT_NS_1SEC_64 46 46 + tsp.tv_nsec; 47 47 } … … 50 50 RTDECL(uint64_t) RTTimeMilliTS(void) 51 51 { 52 return RTTimeNanoTS() / 1000;52 return RTTimeNanoTS() / RT_NS_1MS; 53 53 } 54 54 … … 72 72 return RTTimeSpecSetTimespec(pTime, &tsp); 73 73 } 74 -
trunk/src/VBox/Runtime/r0drv/haiku/time-r0drv-haiku.c
r43403 r52822 5 5 6 6 /* 7 * Copyright (C) 2012 Oracle Corporation7 * Copyright (C) 2012-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 39 39 DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void) 40 40 { 41 return system_time() * 1000;41 return system_time() * RT_NS_1US; 42 42 } 43 43 … … 45 45 DECLINLINE(uint64_t) rtTimeGetSystemMilliTS(void) 46 46 { 47 return system_time() / 1000;47 return system_time() / RT_NS_1US; 48 48 } 49 49 … … 75 75 RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime) 76 76 { 77 return RTTimeSpecSetNano(pTime, real_time_clock_usecs() * 1000);77 return RTTimeSpecSetNano(pTime, real_time_clock_usecs() * RT_NS_1US); 78 78 } 79 79 -
trunk/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
r44528 r52822 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 46 46 struct timespec Ts; 47 47 ktime_get_ts(&Ts); 48 u64 = Ts.tv_sec * UINT64_C(1000000000)+ Ts.tv_nsec;48 u64 = Ts.tv_sec * RT_NS_1SEC_64 + Ts.tv_nsec; 49 49 return u64; 50 50 … … 149 149 RTDECL(uint64_t) RTTimeMilliTS(void) 150 150 { 151 return rtTimeGetSystemNanoTS() / 1000000;151 return rtTimeGetSystemNanoTS() / RT_NS_1MS; 152 152 } 153 153 RT_EXPORT_SYMBOL(RTTimeMilliTS); … … 163 163 RTDECL(uint64_t) RTTimeSystemMilliTS(void) 164 164 { 165 return rtTimeGetSystemNanoTS() / 1000000;165 return rtTimeGetSystemNanoTS() / RT_NS_1MS; 166 166 } 167 167 RT_EXPORT_SYMBOL(RTTimeSystemMilliTS); -
trunk/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp
r48935 r52822 5 5 6 6 /* 7 * Copyright (C) 2007-201 0Oracle Corporation7 * Copyright (C) 2007-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 80 80 RTDECL(uint64_t) RTTimeMilliTS(void) 81 81 { 82 return rtTimeGetSystemNanoTS() / 1000000;82 return rtTimeGetSystemNanoTS() / RT_NS_1MS; 83 83 } 84 84 … … 92 92 RTDECL(uint64_t) RTTimeSystemMilliTS(void) 93 93 { 94 return rtTimeGetSystemNanoTS() / 1000000;94 return rtTimeGetSystemNanoTS() / RT_NS_1MS; 95 95 } 96 96 -
trunk/src/VBox/Runtime/r0drv/solaris/time-r0drv-solaris.c
r44528 r52822 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 43 43 RTDECL(uint64_t) RTTimeMilliTS(void) 44 44 { 45 return RTTimeNanoTS() / 1000000;45 return RTTimeNanoTS() / RT_NS_1MS; 46 46 } 47 47 … … 55 55 RTDECL(uint64_t) RTTimeSystemMilliTS(void) 56 56 { 57 return RTTimeNanoTS() / 1000000;57 return RTTimeNanoTS() / RT_NS_1MS; 58 58 } 59 59 … … 66 66 TimeSpec = tod_get(); 67 67 mutex_exit(&tod_lock); 68 return RTTimeSpecSetNano(pTime, (uint64_t)TimeSpec.tv_sec * 1000000000+ TimeSpec.tv_nsec);68 return RTTimeSpecSetNano(pTime, (uint64_t)TimeSpec.tv_sec * RT_NS_1SEC + TimeSpec.tv_nsec); 69 69 } 70 70 -
trunk/src/VBox/Runtime/r0drv/solaris/timer-r0drv-solaris.c
r48186 r52822 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as -
trunk/src/VBox/Runtime/r3/darwin/time-darwin.cpp
r48935 r52822 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 89 89 struct timeval tv; 90 90 gettimeofday(&tv, NULL); 91 return (uint64_t)tv.tv_sec * (uint64_t)(1000 * 1000 * 1000)92 + (uint64_t)(tv.tv_usec * 1000);91 return (uint64_t)tv.tv_sec * RT_NS_1SEC_64 92 + (uint64_t)(tv.tv_usec * RT_NS_1US); 93 93 } 94 94 … … 102 102 RTDECL(uint64_t) RTTimeSystemMilliTS(void) 103 103 { 104 return rtTimeGetSystemNanoTS() / 1000000;104 return rtTimeGetSystemNanoTS() / RT_NS_1MS; 105 105 } 106 106 -
trunk/src/VBox/Runtime/r3/haiku/time-haiku.cpp
r45356 r52822 5 5 6 6 /* 7 * Copyright (C) 2012-201 3Oracle Corporation7 * Copyright (C) 2012-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 44 44 DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void) 45 45 { 46 return (uint64_t)system_time() * 1000;46 return (uint64_t)system_time() * RT_NS_1US; 47 47 } 48 48 … … 72 72 RTDECL(uint64_t) RTTimeSystemMilliTS(void) 73 73 { 74 return rtTimeGetSystemNanoTS() / 1000000;74 return rtTimeGetSystemNanoTS() / RT_NS_1MS; 75 75 } 76 76 … … 83 83 return VINF_SUCCESS; 84 84 } 85 -
trunk/src/VBox/Runtime/r3/linux/time-linux.cpp
r48935 r52822 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 119 119 struct timespec ts; 120 120 if (!mono_clock(&ts)) 121 return (uint64_t)ts.tv_sec * (uint64_t)(1000 * 1000 * 1000)121 return (uint64_t)ts.tv_sec * RT_NS_1SEC_64 122 122 + ts.tv_nsec; 123 123 fMonoClock = false; … … 127 127 struct timeval tv; 128 128 gettimeofday(&tv, NULL); 129 return (uint64_t)tv.tv_sec * (uint64_t)(1000 * 1000 * 1000)130 + (uint64_t)(tv.tv_usec * 1000);129 return (uint64_t)tv.tv_sec * RT_NS_1SEC_64 130 + (uint64_t)(tv.tv_usec * RT_NS_1US); 131 131 } 132 132 … … 156 156 RTDECL(uint64_t) RTTimeSystemMilliTS(void) 157 157 { 158 return rtTimeGetSystemNanoTS() / 1000000;158 return rtTimeGetSystemNanoTS() / RT_NS_1MS; 159 159 } 160 160 -
trunk/src/VBox/Runtime/r3/posix/time-posix.cpp
r48935 r52822 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 47 47 struct timespec ts; 48 48 if (!clock_gettime(CLOCK_MONOTONIC, &ts)) 49 return (uint64_t)ts.tv_sec * (uint64_t)(1000 * 1000 * 1000)49 return (uint64_t)ts.tv_sec * RT_NS_1SEC_64 50 50 + ts.tv_nsec; 51 51 s_fMonoClock = false; … … 56 56 struct timeval tv; 57 57 gettimeofday(&tv, NULL); 58 return (uint64_t)tv.tv_sec * (uint64_t)(1000 * 1000 * 1000)59 + (uint64_t)(tv.tv_usec * 1000);58 return (uint64_t)tv.tv_sec * RT_NS_1SEC_64 59 + (uint64_t)(tv.tv_usec * RT_NS_1US); 60 60 } 61 61 … … 85 85 RTDECL(uint64_t) RTTimeSystemMilliTS(void) 86 86 { 87 return rtTimeGetSystemNanoTS() / 1000000;87 return rtTimeGetSystemNanoTS() / RT_NS_1MS; 88 88 } 89 89 -
trunk/src/VBox/Runtime/r3/win/time-win.cpp
r48935 r52822 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 79 79 * This would work if it didn't flip over every 49 (or so) days. 80 80 */ 81 return (uint64_t)GetTickCount() * (uint64_t)1000000;81 return (uint64_t)GetTickCount() * RT_NS_1MS_64; 82 82 83 83 #elif defined USE_PERFORMANCE_COUNTER … … 90 90 { 91 91 if (!QueryPerformanceFrequency(&llFreq)) 92 return (uint64_t)GetTickCount() * (uint64_t)1000000;92 return (uint64_t)GetTickCount() * RT_NS_1MS_64; 93 93 llFreq.QuadPart /= 1000; 94 94 uMult = 1000000; /* no math genius, but this seemed to help avoiding floating point. */ … … 98 98 if (QueryPerformanceCounter(&ll)) 99 99 return (ll.QuadPart * uMult) / llFreq.QuadPart; 100 return (uint64_t)GetTickCount() * (uint64_t)1000000;100 return (uint64_t)GetTickCount() * RT_NS_1MS_64; 101 101 102 102 #elif defined USE_FILE_TIME … … 149 149 RTDECL(uint64_t) RTTimeSystemMilliTS(void) 150 150 { 151 return rtTimeGetSystemNanoTS() / 1000000;151 return rtTimeGetSystemNanoTS() / RT_NS_1MS; 152 152 } 153 153 … … 196 196 Tzi.Bias = 0; 197 197 if (GetTimeZoneInformation(&Tzi) != TIME_ZONE_ID_INVALID) 198 return -(int64_t)Tzi.Bias * 60 *1000*1000*1000;198 return -(int64_t)Tzi.Bias * 60 * RT_NS_1MS_64; 199 199 return 0; 200 200 }
Note:
See TracChangeset
for help on using the changeset viewer.