11 #if defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
13 #elif defined(_WIN32) || defined(_WIN64)
21 #if defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
23 time_t seconds = time(
nullptr);
27 if (
local.tm_isdst > 0)
37 #elif defined(_WIN32) || defined(_WIN64)
40 DYNAMIC_TIME_ZONE_INFORMATION dtzi;
41 DWORD result = GetDynamicTimeZoneInformation(&dtzi);
44 case TIME_ZONE_ID_UNKNOWN:
45 name = dtzi.TimeZoneKeyName;
49 case TIME_ZONE_ID_STANDARD:
50 name = dtzi.StandardName;
54 case TIME_ZONE_ID_DAYLIGHT:
55 name = dtzi.DaylightName;
63 if (!WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS,
name, -1, buffer, 1024,
nullptr,
nullptr))
int64_t seconds() const noexcept
Get total seconds of the current timespan.
int64_t minutes() const noexcept
Get total minutes of the current timespan.
static Timespan zero() noexcept
Get zero timespan.
Timespan _dstoffset
Timezone daylight saving time offset.
std::string _name
Timezone name.
const std::string & name() const noexcept
Get timezone name.
static Timezone local()
Get the local timezone.
Timezone()
Initialize timezone with a current local timezone.
Timespan _offset
Timezone offset.
#define throwex
Throw extended exception macro.
C++ Common project definitions.