Skip to content

Commit

Permalink
msvc/gettimeofday.c: clang-formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
HuidaeCho committed Sep 15, 2024
1 parent 3ebded4 commit 7fa9bd0
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions msvc/gettimeofday.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,35 @@ static const unsigned __int64 epoch = UINT64CONST(116444736000000000);
* FILETIME represents the number of 100-nanosecond intervals since
* January 1, 1601 (UTC).
*/
#define FILETIME_UNITS_PER_SEC 10000000L
#define FILETIME_UNITS_PER_SEC 10000000L
#define FILETIME_UNITS_PER_USEC 10


/*
* timezone information is stored outside the kernel so tzp isn't used anymore.
*
* Note: this function is not for Win32 high precision timing purposes. See
* elapsed_time().
*/
int
gettimeofday(struct timeval *tp, void *tzp)
int gettimeofday(struct timeval *tp, void *tzp)
{
FILETIME file_time;
ULARGE_INTEGER ularge;
FILETIME file_time;
ULARGE_INTEGER ularge;

/*
* POSIX declines to define what tzp points to, saying "If tzp is not a
* null pointer, the behavior is unspecified". Let's take this
* opportunity to verify that noplace in Postgres tries to use any
* unportable behavior.
*/
Assert(tzp == NULL);
/*
* POSIX declines to define what tzp points to, saying "If tzp is not a
* null pointer, the behavior is unspecified". Let's take this
* opportunity to verify that noplace in Postgres tries to use any
* unportable behavior.
*/
Assert(tzp == NULL);

GetSystemTimePreciseAsFileTime(&file_time);
ularge.LowPart = file_time.dwLowDateTime;
ularge.HighPart = file_time.dwHighDateTime;
GetSystemTimePreciseAsFileTime(&file_time);
ularge.LowPart = file_time.dwLowDateTime;
ularge.HighPart = file_time.dwHighDateTime;

tp->tv_sec = (long) ((ularge.QuadPart - epoch) / FILETIME_UNITS_PER_SEC);
tp->tv_usec = (long) (((ularge.QuadPart - epoch) % FILETIME_UNITS_PER_SEC)
/ FILETIME_UNITS_PER_USEC);
tp->tv_sec = (long)((ularge.QuadPart - epoch) / FILETIME_UNITS_PER_SEC);
tp->tv_usec = (long)(((ularge.QuadPart - epoch) % FILETIME_UNITS_PER_SEC) /
FILETIME_UNITS_PER_USEC);

return 0;
return 0;
}

0 comments on commit 7fa9bd0

Please sign in to comment.