From 727e951d8c49a98d2c37378c863cd050b8d768eb Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 4 Nov 2013 00:12:07 -0500 Subject: [PATCH] Windows; GetSystemTimeAsFileTime As per Raymond Chen's "The Old New Thing" blog http://blogs.msdn.com/b/oldnewthing/archive/2013/11/01/10462403.aspx Calling GetSystemTime() followed by SystemTimeToFileTime() performs two format translations which can be avoided by using GetSystemTimeAsFileTime() directly. Change-Id: I3d3de0e045777c9dfdb1c1f4503bfdfe19fb7b73 Reviewed-on: http://gerrit.openafs.org/10430 Tested-by: BuildBot Reviewed-by: Jeffrey Altman --- src/WINNT/client_osi/osisleep.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/WINNT/client_osi/osisleep.c b/src/WINNT/client_osi/osisleep.c index 14ace2b4b4..690f1184a6 100644 --- a/src/WINNT/client_osi/osisleep.c +++ b/src/WINNT/client_osi/osisleep.c @@ -197,7 +197,6 @@ void osi_Init(void) static osi_once_t once; unsigned long remainder; /* for division output */ osi_fdType_t *typep; - SYSTEMTIME sysTime; FILETIME fileTime; osi_hyper_t bootTime; @@ -206,8 +205,7 @@ void osi_Init(void) return; /* setup boot time values */ - GetSystemTime(&sysTime); - SystemTimeToFileTime(&sysTime, &fileTime); + GetSystemTimeAsFileTime(&fileTime); /* change the base of the time so it won't be negative for a long time */ fileTime.dwHighDateTime -= 28000000; @@ -708,13 +706,11 @@ void osi_panic(char *msgp, char *filep, long line) time_t osi_Time(void) { FILETIME fileTime; - SYSTEMTIME sysTime; unsigned long remainder; LARGE_INTEGER bootTime; /* setup boot time values */ - GetSystemTime(&sysTime); - SystemTimeToFileTime(&sysTime, &fileTime); + GetSystemTimeAsFileTime(&fileTime); /* change the base of the time so it won't be negative for a long time */ fileTime.dwHighDateTime -= 28000000; @@ -737,13 +733,11 @@ time_t osi_Time(void) void osi_GetTime(long *timesp) { FILETIME fileTime; - SYSTEMTIME sysTime; unsigned long remainder; LARGE_INTEGER bootTime; /* setup boot time values */ - GetSystemTime(&sysTime); - SystemTimeToFileTime(&sysTime, &fileTime); + GetSystemTimeAsFileTime(&fileTime); /* change the base of the time so it won't be negative for a long time */ fileTime.dwHighDateTime -= 28000000;