Go to the source code of this file.
◆ _localtime32()
Definition at line 203 of file localtime.cpp.
204{
205 return common_localtime(ptime);
206}
◆ _localtime32_s()
Definition at line 165 of file localtime.cpp.
169{
171}
static errno_t __cdecl common_localtime_s(tm *const ptm, TimeType const *const ptime)
◆ _localtime64()
◆ _localtime64_s()
◆ _Success_()
_Success_ |
( |
return ! |
= 0 | ) |
const |
throw | ( | |
| ) | | |
Definition at line 187 of file localtime.cpp.
189{
191
193 if (ptm == nullptr)
194 return nullptr;
195
198 return nullptr;
199
200 return ptm;
201}
tm *__cdecl __getgmtimebuf()
◆ common_localtime_s()
Definition at line 33 of file localtime.cpp.
37{
39
42
44
45
48
50
52 long dstbias = 0;
57
58 if (*ptime > 3 *
_DAY_SEC && *ptime < time_traits::max_time_t - 3 *
_DAY_SEC)
59 {
60
61
62
63
65
66 errno_t status0 = time_traits::gmtime_s(ptm, <ime);
67 if (status0 != 0)
68 return status0;
69
70
72 {
73 ltime -= dstbias;
74
75 errno_t const status1 = time_traits::gmtime_s(ptm, <ime);
76 if (status1 != 0)
77 return status1;
78
80 }
81 }
82 else
83 {
84
85
86
87
88
89 errno_t const status0 = time_traits::gmtime_s(ptm, ptime);
90 if (status0 != 0)
91 return status0;
92
93 TimeType ltime =
static_cast<TimeType
>(ptm->
tm_sec);
94
95
97 {
100 }
101 else
102 {
104 }
105
106 ptm->
tm_sec =
static_cast<int>(ltime % 60);
108 {
110 ltime -= 60;
111 }
112
113 ltime =
static_cast<TimeType
>(ptm->
tm_min) + ltime / 60;
114 ptm->
tm_min =
static_cast<int>(ltime % 60);
116 {
118 ltime -= 60;
119 }
120
121 ltime =
static_cast<TimeType
>(ptm->
tm_hour) + ltime / 60;
122 ptm->
tm_hour =
static_cast<int>(ltime % 24);
124 {
126 ltime -=24;
127 }
128
129 ltime /= 24;
130
131 if (ltime > 0)
132 {
133
134
136 ptm->
tm_mday +=
static_cast<int>(ltime);
137 ptm->
tm_yday +=
static_cast<int>(ltime);
138 }
139 else if (ltime < 0)
140 {
141
142
144 ptm->
tm_mday +=
static_cast<int>(ltime);
146 {
148
149
150
154 }
155 else
156 {
157 ptm->
tm_yday +=
static_cast<int>(ltime);
158 }
159 }
160 }
161
162 return 0;
163}
int __cdecl _isindst(_In_ tm *_Time)
#define _VALIDATE_RETURN_ERRCODE(expr, errorcode)
#define _VALIDATE_RETURN_ERRCODE_NOEXC(expr, errorcode)
_CRTIMP errno_t __cdecl _get_daylight(_Out_ int *_Daylight)
_CRTIMP errno_t __cdecl _get_dstbias(_Out_ long *_Daylight_savings_bias)
_CRTIMP errno_t __cdecl _get_timezone(_Out_ long *_Timezone)
Referenced by _localtime32_s(), and _localtime64_s().