ReactOS 0.4.15-dev-7958-gcd0bb1a
systime.c File Reference
#include <precomp.h>
Include dependency graph for systime.c:

Go to the source code of this file.

Functions

unsigned int _getsystime (struct tm *tp)
 
unsigned int _setsystime (struct tm *tp, unsigned int ms)
 

Variables

int month [12] = { 31,28,31,30,31,30,31,31,30,31,30,31}
 

Function Documentation

◆ _getsystime()

unsigned int _getsystime ( struct tm tp)

Definition at line 18 of file systime.c.

19{
21 int i;
22 DWORD TimeZoneId;
23 TIME_ZONE_INFORMATION TimeZoneInformation;
24
26
27 tp->tm_year = Time.wYear - 1900;
28 tp->tm_mon = Time.wMonth - 1;
29 tp->tm_wday = Time.wDayOfWeek;
30 tp->tm_mday = Time.wDay;
31 tp->tm_hour = Time.wHour;
32 tp->tm_min = Time.wMinute;
33 tp->tm_sec = Time.wSecond;
34
35 tp->tm_isdst = -1;
36
37 TimeZoneId = GetTimeZoneInformation(&TimeZoneInformation);
38 if (TimeZoneId == TIME_ZONE_ID_DAYLIGHT){
39 tp->tm_isdst = 1;
40 }
41 else
42 tp->tm_isdst = 0;
43
44 if (tp->tm_year % 4 == 0) {
45 if (tp->tm_year % 100 != 0)
46 tp->tm_yday = 1;
47 else if ((tp->tm_year-100) % 1000 == 0)
48 tp->tm_yday = 1;
49 }
50
51 for (i = 0; i <= tp->tm_mon; i++)
52 tp->tm_yday += month[i];
53
54 return Time.wMilliseconds;
55}
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
DWORD WINAPI GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation)
Definition: timezone.c:262
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static PLARGE_INTEGER Time
Definition: time.c:105
#define TIME_ZONE_ID_DAYLIGHT
Definition: rtltypes.h:254
int month[12]
Definition: systime.c:13

◆ _setsystime()

unsigned int _setsystime ( struct tm tp,
unsigned int  ms 
)

Definition at line 61 of file systime.c.

62{
64
65 Time.wYear = tp->tm_year + 1900;
66 Time.wMonth = tp->tm_mon + 1;
67 Time.wDayOfWeek = tp->tm_wday;
68 Time.wDay = tp->tm_mday;
69 Time.wHour = tp->tm_hour;
70 Time.wMinute = tp->tm_min;
71 Time.wSecond = tp->tm_sec;
72 Time.wMilliseconds = ms;
73
74 if (!SetLocalTime(&Time))
75 return -1;
76
77 return 0;
78}
BOOL WINAPI SetLocalTime(IN CONST SYSTEMTIME *lpSystemTime)
Definition: time.c:356

Variable Documentation

◆ month

int month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31}

Definition at line 13 of file systime.c.

Referenced by _getsystime().