ReactOS  0.4.14-dev-98-gb0d4763
time.h
Go to the documentation of this file.
1 #define DIFFTIME 0x19db1ded53e8000ULL
2 #define DIFFDAYS (3 * DAYSPER100YEARS + 17 * DAYSPER4YEARS + 1 * DAYSPERYEAR)
3 
4 #define DAYSPERYEAR 365
5 #define DAYSPER4YEARS (4*DAYSPERYEAR+1)
6 #define DAYSPER100YEARS (25*DAYSPER4YEARS-1)
7 #define DAYSPER400YEARS (4*DAYSPER100YEARS+1)
8 #define SECONDSPERDAY (24*60*60)
9 #define SECONDSPERHOUR (60*60)
10 #define LEAPDAY 59
11 
12 static __inline
14 FileTimeToUnixTime(const FILETIME *FileTime, USHORT *millitm)
15 {
16  ULARGE_INTEGER ULargeInt;
18 
19  ULargeInt.LowPart = FileTime->dwLowDateTime;
20  ULargeInt.HighPart = FileTime->dwHighDateTime;
21  ULargeInt.QuadPart -= DIFFTIME;
22 
23  time = ULargeInt.QuadPart / 10000000;
24  if (millitm)
25  *millitm = (USHORT)((ULargeInt.QuadPart % 10000000) / 10000);
26 
27  return time;
28 }
29 
30 static __inline
31 long leapyears_passed(long days)
32 {
33  long quadcenturies, centuries, quadyears;
34  quadcenturies = days / DAYSPER400YEARS;
35  days -= quadcenturies;
36  centuries = days / DAYSPER100YEARS;
37  days += centuries;
38  quadyears = days / DAYSPER4YEARS;
39  return quadyears - centuries + quadcenturies;
40 }
41 
42 static __inline
43 long leapdays_passed(long days)
44 {
45  return leapyears_passed(days + DAYSPERYEAR - LEAPDAY + 1);
46 }
47 
48 static __inline
49 long years_passed(long days)
50 {
51  return (days - leapdays_passed(days)) / 365;
52 }
53 
54 extern long dst_begin;
55 extern long dst_end;
#define LEAPDAY
Definition: time.h:10
#define DAYSPER4YEARS
Definition: time.h:5
long dst_end
Definition: timezone.c:17
$ULONG LowPart
Definition: ntbasedef.h:576
static __inline long years_passed(long days)
Definition: time.h:49
#define DIFFTIME
Definition: time.h:1
DWORD dwHighDateTime
Definition: mapidefs.h:66
static __inline __time64_t FileTimeToUnixTime(const FILETIME *FileTime, USHORT *millitm)
Definition: time.h:14
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define DAYSPER400YEARS
Definition: time.h:7
static __inline long leapdays_passed(long days)
Definition: time.h:43
$ULONG HighPart
Definition: ntbasedef.h:577
long dst_begin
Definition: timezone.c:16
#define DAYSPER100YEARS
Definition: time.h:6
unsigned short USHORT
Definition: pedump.c:61
static __inline long leapyears_passed(long days)
Definition: time.h:31
_CRTIMP time_t __cdecl time(time_t *_Time)
Definition: time.h:428
DWORD dwLowDateTime
Definition: mapidefs.h:65
__MINGW_EXTENSION typedef __int64 __time64_t
Definition: crtdefs.h:364
#define DAYSPERYEAR
Definition: time.h:4