PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
win32gettimeofday.c File Reference
#include "c.h"
#include <sysinfoapi.h>
#include <sys/time.h>
Include dependency graph for win32gettimeofday.c:

Go to the source code of this file.

Macros

#define FILETIME_UNITS_PER_SEC   10000000L
 
#define FILETIME_UNITS_PER_USEC   10
 

Functions

int gettimeofday (struct timeval *tp, void *tzp)
 

Variables

static const unsigned __int64 epoch = UINT64CONST(116444736000000000)
 

Macro Definition Documentation

◆ FILETIME_UNITS_PER_SEC

#define FILETIME_UNITS_PER_SEC   10000000L

Definition at line 42 of file win32gettimeofday.c.

◆ FILETIME_UNITS_PER_USEC

#define FILETIME_UNITS_PER_USEC   10

Definition at line 43 of file win32gettimeofday.c.

Function Documentation

◆ gettimeofday()

int gettimeofday ( struct timeval *  tp,
void *  tzp 
)

Definition at line 53 of file win32gettimeofday.c.

54{
55 FILETIME file_time;
56 ULARGE_INTEGER ularge;
57
58 /*
59 * POSIX declines to define what tzp points to, saying "If tzp is not a
60 * null pointer, the behavior is unspecified". Let's take this
61 * opportunity to verify that noplace in Postgres tries to use any
62 * unportable behavior.
63 */
64 Assert(tzp == NULL);
65
66 GetSystemTimePreciseAsFileTime(&file_time);
67 ularge.LowPart = file_time.dwLowDateTime;
68 ularge.HighPart = file_time.dwHighDateTime;
69
70 tp->tv_sec = (long) ((ularge.QuadPart - epoch) / FILETIME_UNITS_PER_SEC);
71 tp->tv_usec = (long) (((ularge.QuadPart - epoch) % FILETIME_UNITS_PER_SEC)
73
74 return 0;
75}
#define Assert(condition)
Definition: c.h:812
#define FILETIME_UNITS_PER_USEC
#define FILETIME_UNITS_PER_SEC
static const unsigned __int64 epoch

References Assert, epoch, FILETIME_UNITS_PER_SEC, and FILETIME_UNITS_PER_USEC.

Referenced by basic_archive_file(), BootStrapXLOG(), feGetCurrentTimestamp(), get_formatted_log_time(), get_real_time_ns_ascending(), GetCurrentTimestamp(), GuessControlValues(), IsCheckpointOnSchedule(), libpq_prng_init(), log_status_format(), main(), make_outputdirs(), modify_subscriber_sysid(), PerformRadiusTransaction(), pg_rusage_init(), PQgetCurrentTimeUSec(), pqTraceFormatTimestamp(), ResetUsage(), run_permutation(), ShowUsage(), timeofday(), and try_complete_step().

Variable Documentation

◆ epoch