253 #if _WIN32_WINNT < _WIN32_WINNT_WS08 254 TIME_ZONE_INFORMATION tzinfo;
255 auto rv = GetTimeZoneInformation(&tzinfo);
257 DYNAMIC_TIME_ZONE_INFORMATION tzinfo;
258 auto rv = GetDynamicTimeZoneInformation(&tzinfo);
260 if (rv == TIME_ZONE_ID_INVALID)
263 int offset = -tzinfo.Bias;
266 offset -= tzinfo.DaylightBias;
270 offset -= tzinfo.StandardBias;
275 #if defined(sun) || defined(__sun) || defined(_AIX) 281 int local_year = localtm.tm_year + (1900 - 1);
282 int gmt_year = gmtm.tm_year + (1900 - 1);
290 + ((local_year >> 2) - (gmt_year >> 2)) - (local_year / 100 - gmt_year / 100) +
291 ((local_year / 100 >> 2) - (gmt_year / 100 >> 2))
294 + (
long int)(local_year - gmt_year) * 365);
296 long int hours = (24 *
days) + (localtm.tm_hour - gmtm.tm_hour);
297 long int mins = (60 * hours) + (localtm.tm_min - gmtm.tm_min);
298 long int secs = (60 * mins) + (localtm.tm_sec - gmtm.tm_sec);
304 auto offset_seconds = helper::calculate_gmt_offset(tm);
306 auto offset_seconds = tm.tm_gmtoff;
309 return static_cast<int>(offset_seconds / 60);
int errno
Contains the last error code.
std::tm localtime(std::time_t time)
static const char * days[]
std::tm gmtime(std::time_t time)