ReactOS 0.4.16-dev-927-g467dec4
strtime.cpp File Reference
Include dependency graph for strtime.cpp:

Go to the source code of this file.

Functions

template<typename Character >
 _Success_ (buffer !=0 &&size_in_chars >=9) static errno_t __cdecl common_strtime_s(_Out_writes_z_(size_in_chars) Character *const buffer
 
_In_ _In_range_ (>=, 9) size_t const size_in_chars) throw ()
 
errno_t __cdecl _strtime_s (char *const buffer, size_t const size_in_chars)
 
errno_t __cdecl _wstrtime_s (wchar_t *const buffer, size_t const size_in_chars)
 
char *__cdecl _strtime (char *const buffer)
 
wchar_t *__cdecl _wstrtime (wchar_t *const buffer)
 

Function Documentation

◆ _In_range_()

_In_ _In_range_ ( >=  ,
 
) const
throw (
)

Definition at line 21 of file strtime.cpp.

23{
24 _VALIDATE_RETURN_ERRCODE(buffer != nullptr && size_in_chars > 0, EINVAL);
25 _RESET_STRING(buffer, size_in_chars);
26 _VALIDATE_RETURN_ERRCODE(size_in_chars >= 9, ERANGE);
27
30
31 int const hours = local_time.wHour;
32 int const minutes = local_time.wMinute;
33 int const seconds = local_time.wSecond;
34
35 static Character const zero_char = static_cast<Character>('0');
36
37#pragma warning(disable:__WARNING_INCORRECT_VALIDATION) // 26014 Prefast doesn't notice the validation.
38
39 // Store the components of the date into the string in HH:MM:SS form:
40 buffer[0] = static_cast<Character>(hours / 10 + zero_char); // Tens of hour
41 buffer[1] = static_cast<Character>(hours % 10 + zero_char); // Units of hour
42 buffer[2] = static_cast<Character>(':');
43 buffer[3] = static_cast<Character>(minutes / 10 + zero_char); // Tens of minute
44 buffer[4] = static_cast<Character>(minutes % 10 + zero_char); // Units of minute
45 buffer[5] = static_cast<Character>(':');
46 buffer[6] = static_cast<Character>(seconds / 10 + zero_char); // Tens of second
47 buffer[7] = static_cast<Character>(seconds % 10 + zero_char); // Units of second
48 buffer[8] = static_cast<Character>('\0');
49
50 return 0;
51}
#define EINVAL
Definition: acclib.h:90
#define ERANGE
Definition: acclib.h:92
#define _RESET_STRING(_String, _Size)
static DOUBLE local_time(DOUBLE time, DateInstance *date)
Definition: date.c:351
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
GLuint buffer
Definition: glext.h:5915
#define _VALIDATE_RETURN_ERRCODE(expr, errorcode)

◆ _strtime()

char *__cdecl _strtime ( char *const  buffer)

Definition at line 80 of file strtime.cpp.

81{
82 return common_strtime(buffer);
83}

◆ _strtime_s()

errno_t __cdecl _strtime_s ( char *const  buffer,
size_t const  size_in_chars 
)

Definition at line 53 of file strtime.cpp.

54{
55 return common_strtime_s(buffer, size_in_chars);
56}

◆ _Success_()

template<typename Character >
_Success_ ( buffer = 0 && size_in_chars >= 9) const

Definition at line 69 of file strtime.cpp.

72{
73 errno_t const status = common_strtime_s(buffer, 9);
74 if (status != 0)
75 return nullptr;
76
77 return buffer;
78}
Definition: ps.c:97
int errno_t
Definition: corecrt.h:615

◆ _wstrtime()

wchar_t *__cdecl _wstrtime ( wchar_t *const  buffer)

Definition at line 85 of file strtime.cpp.

86{
87 return common_strtime(buffer);
88}

◆ _wstrtime_s()

errno_t __cdecl _wstrtime_s ( wchar_t *const  buffer,
size_t const  size_in_chars 
)

Definition at line 58 of file strtime.cpp.

59{
60 return common_strtime_s(buffer, size_in_chars);
61}