14#define ChkAdd(dest, src1, src2) \
15 (((src1 >= 0L) && (src2 >= 0L) && (dest < 0L)) || \
16 ((src1 < 0L) && (src2 < 0L) && (dest >= 0L)))
19#define ChkMul(dest, src1, src2) ( src1 ? (dest / src1 != src2) : 0 )
26template <
typename TimeType>
29 bool const use_local_time
34 TimeType
const invalid_time =
static_cast<TimeType
>(-1);
38 TimeType tmptm1, tmptm2, tmptm3;
41 if ((tmptm1 =
tb->tm_year) <
_BASE_YEAR - 1 || tmptm1 > time_traits::max_year + 1)
46 if (
tb->tm_mon < 0 ||
tb->tm_mon > 11)
49 tmptm1 += (
tb->tm_mon / 12);
51 if ((
tb->tm_mon %= 12) < 0)
58 if (tmptm1 < _BASE_YEAR - 1 || tmptm1 > time_traits::max_year + 1)
81 tmptm1 = tmptm3 + (tmptm2 =
static_cast<TimeType
>(
tb->tm_mday));
91 tmptm1 = tmptm2 + (tmptm3 =
static_cast<TimeType
>(
tb->tm_hour));
102 tmptm1 = tmptm2 + (tmptm3 =
static_cast<TimeType
>(
tb->tm_min));
109 tmptm2 = tmptm1 * 60L;
113 tmptm1 = tmptm2 + (tmptm3 =
static_cast<TimeType
>(
tb->tm_sec));
135 if (time_traits::localtime_s(&tbtemp, &tmptm1) != 0)
142 if (
tb->tm_isdst > 0 || (
tb->tm_isdst < 0 && tbtemp.
tm_isdst > 0))
145 if (time_traits::localtime_s(&tbtemp, &tmptm1) != 0)
152 if (time_traits::gmtime_s(&tbtemp, &tmptm1) != 0)
179 return common_mktime<__time32_t>(
tb,
true);
184 return common_mktime<__time64_t>(
tb,
true);
195 return common_mktime<__time32_t>(
tb,
false);
200 return common_mktime<__time64_t>(
tb,
false);
#define _VALIDATE_RETURN(expr, errorcode, retexpr)
bool __cdecl __crt_time_is_leap_year(TimeType const yr)
TimeType __cdecl __crt_time_elapsed_leap_years(TimeType const yr)
#define _VALIDATE_RETURN_NOEXC(expr, errorcode, retexpr)
static TimeType __cdecl common_mktime(tm *const tb, bool const use_local_time)
#define ChkMul(dest, src1, src2)
__time32_t __cdecl _mkgmtime32(tm *const tb)
#define ChkAdd(dest, src1, src2)
__time64_t __cdecl _mktime64(tm *const tb)
__time64_t __cdecl _mkgmtime64(tm *const tb)
__time32_t __cdecl _mktime32(tm *const tb)
_CRTIMP errno_t __cdecl _get_dstbias(_Out_ long *_Daylight_savings_bias)
_CRTIMP errno_t __cdecl _get_timezone(_Out_ long *_Timezone)