ReactOS 0.4.16-dev-959-g2ec3a19
systime.cpp File Reference
Include dependency graph for systime.cpp:

Go to the source code of this file.

Functions

unsigned __cdecl _getsystime (struct tm *const result)
 
unsigned __cdecl _setsystime (struct tm *const source, unsigned const milliseconds)
 

Function Documentation

◆ _getsystime()

unsigned __cdecl _getsystime ( struct tm *const  result)

Definition at line 14 of file systime.cpp.

15{
16 _VALIDATE_RETURN(result != nullptr, EINVAL, 0)
17
20
21 result->tm_isdst = -1; // mktime() computes whether this is
22 // during Standard or Daylight time.
23 result->tm_sec = static_cast<int>(local_time.wSecond);
24 result->tm_min = static_cast<int>(local_time.wMinute);
25 result->tm_hour = static_cast<int>(local_time.wHour);
26 result->tm_mday = static_cast<int>(local_time.wDay);
27 result->tm_mon = static_cast<int>(local_time.wMonth - 1);
28 result->tm_year = static_cast<int>(local_time.wYear - 1900);
29 result->tm_wday = static_cast<int>(local_time.wDayOfWeek);
30
31 // Normalize uninitialized fields:
33
34 return (local_time.wMilliseconds);
35}
#define EINVAL
Definition: acclib.h:90
return
Definition: dirsup.c:529
#define _VALIDATE_RETURN(expr, errorcode, retexpr)
static DOUBLE local_time(DOUBLE time, DateInstance *date)
Definition: date.c:351
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
GLuint64EXT * result
Definition: glext.h:11304
_CRTIMP __time32_t __cdecl _mktime32(_Inout_ struct tm *_Tm)

◆ _setsystime()

unsigned __cdecl _setsystime ( struct tm *const  source,
unsigned const  milliseconds 
)

Definition at line 41 of file systime.cpp.

42{
43 _ASSERTE(source != nullptr);
44 if (source == nullptr)
46
47 // Normalize uninitialized fields:
49
51 local_time.wYear = static_cast<WORD>(source->tm_year + 1900);
52 local_time.wMonth = static_cast<WORD>(source->tm_mon + 1);
53 local_time.wDay = static_cast<WORD>(source->tm_mday);
54 local_time.wHour = static_cast<WORD>(source->tm_hour);
55 local_time.wMinute = static_cast<WORD>(source->tm_min);
56 local_time.wSecond = static_cast<WORD>(source->tm_sec);
57 local_time.wMilliseconds = static_cast<WORD>(milliseconds);
58
60 return static_cast<int>(GetLastError());
61
62 return 0;
63}
#define _ASSERTE(expr)
Definition: crtdbg.h:114
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
BOOL WINAPI SetLocalTime(IN CONST SYSTEMTIME *lpSystemTime)
Definition: time.c:356
unsigned short WORD
Definition: ntddk_ex.h:93
DWORD WINAPI GetLastError(void)
Definition: except.c:1042