ReactOS 0.4.16-dev-91-g764881a
gettimeofday.c File Reference
#include <wintirpc.h>
#include <time.h>
Include dependency graph for gettimeofday.c:

Go to the source code of this file.

Macros

#define DELTA_EPOCH_IN_MICROSECS   11644473600000000ULL
 

Functions

int gettimeofday (struct timeval *tv, struct timezone *tz)
 

Macro Definition Documentation

◆ DELTA_EPOCH_IN_MICROSECS

#define DELTA_EPOCH_IN_MICROSECS   11644473600000000ULL

Definition at line 8 of file gettimeofday.c.

Function Documentation

◆ gettimeofday()

int gettimeofday ( struct timeval tv,
struct timezone tz 
)

Definition at line 11 of file gettimeofday.c.

12{
13 FILETIME ft;
14 unsigned __int64 tmpres = 0;
15 static int tzflag;
16
17 if (NULL != tv)
18 {
20
21 tmpres |= ft.dwHighDateTime;
22 tmpres <<= 32;
23 tmpres |= ft.dwLowDateTime;
24
25 /*converting file time to unix epoch*/
26 tmpres /= 10; /*convert into microseconds*/
27 tmpres -= DELTA_EPOCH_IN_MICROSECS;
28 tv->tv_sec = (long)(tmpres / 1000000UL);
29 tv->tv_usec = (long)(tmpres % 1000000UL);
30 }
31
32 if (NULL != tz)
33 {
34 if (!tzflag)
35 {
36 _tzset();
37 tzflag++;
38 }
39 tz->tz_minuteswest = _timezone / 60;
40 tz->tz_dsttime = _daylight;
41 }
42
43 return 0;
44}
#define __int64
Definition: basetyps.h:16
#define DELTA_EPOCH_IN_MICROSECS
Definition: gettimeofday.c:8
#define NULL
Definition: types.h:112
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
GLbyte GLbyte tz
Definition: glext.h:8756
#define long
Definition: qsort.c:33
_CRTIMP void __cdecl _tzset(void)
Definition: timezone.c:92
int _daylight
Definition: timezone.c:30
long _timezone
Definition: timezone.c:46
DWORD dwHighDateTime
Definition: mapidefs.h:66
DWORD dwLowDateTime
Definition: mapidefs.h:65
unsigned long tv_sec
Definition: linux.h:1738
unsigned long tv_usec
Definition: linux.h:1739