ReactOS 0.4.16-dev-1041-g8b6907f
corecrt_internal_time.h File Reference
#include <corecrt.h>
#include <corecrt_internal.h>
#include <corecrt_internal_traits.h>
#include <io.h>
#include <sys/utime.h>
#include <time.h>
Include dependency graph for corecrt_internal_time.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  __crt_time_time_t_traits< __time32_t >
 
struct  __crt_time_time_t_traits< __time64_t >
 
struct  __crt_time_traits< TimeType, Character >
 
union  __crt_filetime_union
 

Macros

#define _EPOCH_BIAS   116444736000000000ll
 
#define _DAY_SEC   (24 * 60 * 60)
 
#define _YEAR_SEC   (365 * _DAY_SEC)
 
#define _FOUR_YEAR_SEC   (1461 * _DAY_SEC)
 
#define _BASE_YEAR   70
 
#define _BASE_DOW   4
 
#define _MAX_LOCAL_TIME   (14 * 60 * 60)
 
#define _MIN_LOCAL_TIME   (-12 * 60 * 60)
 
#define _TZ_STRINGS_SIZE   64
 

Functions

int __cdecl _isindst (_In_ tm *_Time)
 
void __cdecl __tzset ()
 
tm *__cdecl __getgmtimebuf ()
 
__time32_t __cdecl __loctotime32_t (int, int, int, int, int, int, int)
 
__time64_t __cdecl __loctotime64_t (int, int, int, int, int, int, int)
 
template<typename TimeType >
bool __cdecl __crt_time_is_leap_year (TimeType const yr) throw ()
 
template<typename TimeType >
TimeType __cdecl __crt_time_elapsed_leap_years (TimeType const yr) throw ()
 
bool __cdecl __crt_time_is_day_valid (int const yr, int const mo, int const dy) throw ()
 
int __crt_get_2digit_year (int const year) throw ()
 
int __crt_get_century (int const year) throw ()
 
 _Success_ (return > 0) size_t __cdecl _Wcsftime_l(_Out_writes_z_(max_size) wchar_t *string
 
_Check_return_ _Deref_ret_z_ wchar_t **__cdecl __wide_tzname ()
 

Variables

char const __dnames []
 
char const __mnames []
 
int const _days []
 
int const _lpdays []
 
_In_ size_t max_size
 
_In_ size_t _In_z_ wchar_t constformat
 
_In_ size_t _In_z_ wchar_t const _In_ tm consttimeptr
 
_In_ size_t _In_z_ wchar_t const _In_ tm const _In_opt_ voidlc_time_arg
 
_In_ size_t _In_z_ wchar_t const _In_ tm const _In_opt_ void _In_opt_ _locale_t locale
 

Macro Definition Documentation

◆ _BASE_DOW

#define _BASE_DOW   4

Definition at line 34 of file corecrt_internal_time.h.

◆ _BASE_YEAR

#define _BASE_YEAR   70

Definition at line 33 of file corecrt_internal_time.h.

◆ _DAY_SEC

#define _DAY_SEC   (24 * 60 * 60)

Definition at line 30 of file corecrt_internal_time.h.

◆ _EPOCH_BIAS

#define _EPOCH_BIAS   116444736000000000ll

Definition at line 28 of file corecrt_internal_time.h.

◆ _FOUR_YEAR_SEC

#define _FOUR_YEAR_SEC   (1461 * _DAY_SEC)

Definition at line 32 of file corecrt_internal_time.h.

◆ _MAX_LOCAL_TIME

#define _MAX_LOCAL_TIME   (14 * 60 * 60)

Definition at line 37 of file corecrt_internal_time.h.

◆ _MIN_LOCAL_TIME

#define _MIN_LOCAL_TIME   (-12 * 60 * 60)

Definition at line 40 of file corecrt_internal_time.h.

◆ _TZ_STRINGS_SIZE

#define _TZ_STRINGS_SIZE   64

Definition at line 42 of file corecrt_internal_time.h.

◆ _YEAR_SEC

#define _YEAR_SEC   (365 * _DAY_SEC)

Definition at line 31 of file corecrt_internal_time.h.

Function Documentation

◆ __crt_get_2digit_year()

int __crt_get_2digit_year ( int const  year)
throw (
)
inline

Definition at line 194 of file corecrt_internal_time.h.

195{
196 return (1900 + year) % 100;
197}

Referenced by expand_time(), and throw().

◆ __crt_get_century()

int __crt_get_century ( int const  year)
throw (
)
inline

Definition at line 199 of file corecrt_internal_time.h.

200{
201 return (1900 + year) / 100;
202}

Referenced by expand_time(), and throw().

◆ __crt_time_elapsed_leap_years()

template<typename TimeType >
TimeType __cdecl __crt_time_elapsed_leap_years ( TimeType const  yr)
throw (
)

Definition at line 168 of file corecrt_internal_time.h.

169{
170 static TimeType const leap_years_between_1900_and_1970 = 17;
171
172 TimeType const elapsed_leap_years = ((yr - 1) / 4) - ((yr - 1) / 100) + ((yr + 299) / 400);
173
174 return elapsed_leap_years - leap_years_between_1900_and_1970;
175}

Referenced by common_loctotime_t(), common_mktime(), compute_year(), and cvtdate().

◆ __crt_time_is_day_valid()

bool __cdecl __crt_time_is_day_valid ( int const  yr,
int const  mo,
int const  dy 
)
throw (
)
inline

Definition at line 178 of file corecrt_internal_time.h.

179{
180 if (dy <= 0)
181 return false;
182
183 int const days_in_month = _days[mo + 1] - _days[mo];
184 if (dy <= days_in_month)
185 return true;
186
187 // Special case for February:
188 if (__crt_time_is_leap_year(yr) && mo == 1 && dy <= 29)
189 return true;
190
191 return false;
192}
bool __cdecl __crt_time_is_leap_year(TimeType const yr)
int const _days[]
Definition: days.cpp:14
GLint dy
Definition: linetemp.h:97

Referenced by common_loctotime_t(), and throw().

◆ __crt_time_is_leap_year()

template<typename TimeType >
bool __cdecl __crt_time_is_leap_year ( TimeType const  yr)
throw (
)

Definition at line 153 of file corecrt_internal_time.h.

154{
155 if (yr % 4 == 0 && yr % 100 != 0)
156 return true;
157
158 if ((yr + 1900) % 400 == 0)
159 return true;
160
161 return false;
162}

Referenced by __crt_time_is_day_valid(), common_loctotime_t(), common_mktime(), compute_iso_week(), compute_iso_week_internal(), compute_year(), and cvtdate().

◆ __getgmtimebuf()

tm *__cdecl __getgmtimebuf ( )

Definition at line 154 of file gmtime.cpp.

155{
157 if (ptd == nullptr)
158 {
159 errno = ENOMEM;
160 return nullptr;
161 }
162
163 if (ptd->_gmtime_buffer != nullptr)
164 {
165 return ptd->_gmtime_buffer;
166 }
167
168 ptd->_gmtime_buffer = _malloc_crt_t(tm, 1).detach();
169 if (ptd->_gmtime_buffer == nullptr)
170 {
171 errno = ENOMEM;
172 return nullptr;
173 }
174
175 return ptd->_gmtime_buffer;
176}
#define ENOMEM
Definition: acclib.h:84
__acrt_ptd *__cdecl __acrt_getptd_noexit(void)
_In_ size_t const _In_ int _In_ bool const _In_ unsigned const _In_ __acrt_rounding_mode const _Inout_ __crt_cached_ptd_host & ptd
Definition: cvt.cpp:355
#define errno
Definition: errno.h:18
Definition: time.h:68

Referenced by _Success_().

◆ __loctotime32_t()

__time32_t __cdecl __loctotime32_t ( int  yr,
int  mo,
int  dy,
int  hr,
int  mn,
int  sc,
int  dstflag 
)

Definition at line 93 of file loctotime.cpp.

102{
103 return common_loctotime_t<__time32_t>(yr, mo, dy, hr, mn, sc, dstflag);
104}
HRESULT hr
Definition: shlfolder.c:183

Referenced by convert_system_time_to_time_t().

◆ __loctotime64_t()

__time64_t __cdecl __loctotime64_t ( int  yr,
int  mo,
int  dy,
int  hr,
int  mn,
int  sc,
int  dstflag 
)

Definition at line 106 of file loctotime.cpp.

115{
116 return common_loctotime_t<__time64_t>(yr, mo, dy, hr, mn, sc, dstflag);
117}

Referenced by convert_system_time_to_time_t().

◆ __tzset()

void __cdecl __tzset ( )

Definition at line 392 of file tzset.cpp.

393{
394 auto const first_time = tzset_init_state.dangerous_get_state_array() + __crt_state_management::get_current_state_index();
395
396 if (__crt_interlocked_read(first_time) != 0)
397 {
398 return;
399 }
400
402 __try
403 {
404 if (__crt_interlocked_read(first_time) != 0)
405 {
406 __leave;
407 }
408
409 tzset_nolock();
410
411 _InterlockedIncrement(first_time);
412 }
414 {
416 }
418}
void __cdecl __acrt_unlock(_In_ __acrt_lock_id lock)
Definition: locks.cpp:57
@ __acrt_time_lock
__acrt_lock(__acrt_heap_lock)
long __cdecl _InterlockedIncrement(_Interlocked_operand_ long volatile *_Addend)
#define __try
Definition: pseh2_64.h:188
#define __leave
Definition: pseh2_64.h:192
#define __endtry
Definition: pseh2_64.h:191
#define __finally
Definition: pseh2_64.h:190
static __crt_state_management::dual_state_global< long > tzset_init_state
Definition: tzset.cpp:30
static void __cdecl tzset_nolock()
Definition: tzset.cpp:338

Referenced by common_ftime_s(), common_localtime_s(), common_loctotime_t(), common_mktime(), and expand_time().

◆ __wide_tzname()

Definition at line 185 of file timeset.cpp.

186{
187 return w_tzname.value();
188}
static __crt_state_management::dual_state_global< wchar_t ** > w_tzname
Definition: timeset.cpp:60

Referenced by expand_time(), tzset_from_environment_nolock(), and tzset_from_system_nolock().

◆ _isindst()

int __cdecl _isindst ( _In_ tm _Time)

◆ _Success_()

_Success_ ( return  ,
 
)

Variable Documentation

◆ __dnames

char const __dnames[]
extern

Definition at line 151 of file timeset.cpp.

Referenced by throw().

◆ __mnames

char const __mnames[]
extern

Definition at line 157 of file timeset.cpp.

Referenced by throw().

◆ _days

int const _days[]
extern

◆ _lpdays

int const _lpdays[]
extern

Definition at line 21 of file days.cpp.

Referenced by common_gmtime_s(), and cvtdate().

◆ format

◆ lc_time_arg

Definition at line 209 of file corecrt_internal_time.h.

Referenced by _Wcsftime(), and _Wcsftime_l().

◆ locale

◆ max_size

_In_ size_t max_size

Definition at line 206 of file corecrt_internal_time.h.

◆ timeptr