14 : _id(id), _baseUtcOffset(baseUtcOffset), _displayName(displayName), _standardName(standardName), _daylightName(daylightName), _supportsDaylightSavingTime(supportsDaylightSavingTime) {
27 DYNAMIC_TIME_ZONE_INFORMATION dtzi;
28 DWORD result = GetDynamicTimeZoneInformation(&dtzi);
32 TimeSpan baseUtcOffset(dtzi.Bias * -600000000LL);
36 bool supportsDaylightSavingTime = (result != TIME_ZONE_ID_UNKNOWN);
39 return TimeZoneInfo(
id, baseUtcOffset, displayName, standardName, daylightName, supportsDaylightSavingTime);
48 return TimeZoneInfo(
String(
"UTC"),
TimeSpan(0),
String(
"(UTC) Coordinated Universal Time"),
String(
"Coordinated Universal Time"),
String(
"Coordinated Universal Time"),
false);
53 if (_id ==
"UTC")
return TimeSpan(0);
54 return _baseUtcOffset;
59 if (!_supportsDaylightSavingTime)
return false;
65 return dateTimeOffset;
70 return dateTimeOffset;
75 if (
id ==
"UTC")
return Utc();
81 return _id == other._id;
Represents a Unicode character code point mirroring .NET System.Char.
Represents any time zone in the world.
Represents a point in time, typically expressed as a date and time of day, relative to Coordinated Un...
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Represents a time interval (duration of time or elapsed time) measured as a positive or negative numb...
bool IsDaylightSavingTime(const DateTimeOffset &dateTimeOffset) const
Indicates whether a specified date and time falls in the range of daylight saving time for the time z...
bool SupportsDaylightSavingTime() const
Gets a value that indicates whether the time zone has any daylight saving time rules.
TimeSpan GetBaseUtcOffset() const
Gets the time difference between the current time zone's standard time and Coordinated Universal Time...
bool Equals(const TimeZoneInfo &other) const
Determines whether the current TimeZoneInfo object and another TimeZoneInfo object are equal.
static TimeZoneInfo Utc()
Gets a TimeZoneInfo object that represents the Coordinated Universal Time (UTC) zone.
static TimeZoneInfo Local()
Gets a TimeZoneInfo object that represents the local time zone.
String GetDaylightName() const
Gets the display name for the time zone's daylight saving time.
String GetStandardName() const
Gets the display name for the time zone's standard time.
static DateTimeOffset ConvertTime(const DateTimeOffset &dateTimeOffset, const TimeZoneInfo &destinationTimeZone)
Converts a time to the time in another time zone.
String GetDisplayName() const
Gets the general display name that represents the time zone.
String GetId() const
Gets the time zone identifier.
TimeSpan GetUtcOffset(const DateTimeOffset &dateTimeOffset) const
Calculates the offset or difference between the time in this time zone and UTC for a particular point...
static TimeZoneInfo FindSystemTimeZoneById(const String &id)
Retrieves a TimeZoneInfo object from the registry or system database based on its identifier.
std::string WCharToUtf8(const wchar_t *pWStr)