#include <Timezone.h>
Public Member Functions | |
Timezone ()=delete | |
nonvirtual String | AsHHMM (const Date &date, const TimeOfDay &tod, bool insertColon) const |
nonvirtual String | AsRFC1123 (const Date &date, const TimeOfDay &tod) const |
nonvirtual BiasInMinutesFromUTCType | GetBiasInMinutesFromUTC (const Date &date, const TimeOfDay &tod) const |
nonvirtual make_signed_t< time_t > | GetBiasFromUTC (const Date &date, const TimeOfDay &tod) const |
nonvirtual optional< bool > | IsDaylightSavingsTime (const Date &date, const optional< TimeOfDay > &tod) |
nonvirtual Characters::String | ToString () const |
Static Public Member Functions | |
static optional< Timezone > | ParseTimezoneOffsetString (const char *tzStr) |
Static Public Attributes | |
static constexpr Traversal::Range< BiasInMinutesFromUTCType > | kBiasInMinutesFromUTCTypeValidRange {-24 * 60, 24 * 60} |
static const Timezone | kUTC {TZ_::eUTC} |
static const Timezone | kLocalTime {TZ_::eLocalTime} |
static const optional< Timezone > | kUnknown {nullopt} |
The Timezone class represents what one would think of as a timezone - mostly.
But - it only supports these timezones: o UTC o LocalTime () special - whatever timezone this computer is in o Fixed Offset from UTC (suitable for reading and writing ISO8601 times)
But it currently does NOT support the notion of timezone like American/NewYork (unless that happens to be localtime) That feature may be eventually added - http://stroika-bugs.sophists.com/browse/STK-636
Definition at line 104 of file Timezone.h.
|
delete |
if ValidationStrategy is eAssert (DEFAULT if not specified)
|
static |
Parse string of the form: [+-]?HHMM, or [+-]?HH:MM, so for example -0500 is Timezone (-5*60), or -04:00 would be Timezone (-4*60).
On empty string, return nullopt, but on ill-formed timezone offset string (including out of range), throw (even if the string is EST, or some such - this requires numeric offset).
This parse function ignores any bad data at the end of tzStr (perhaps future version will be optionally more picky).
Definition at line 75 of file Timezone.cpp.
generate a string of the form: [+-]?HHMM, or [+-]?HH:MM, so for example -0500 is Timezone (-5*60), or -04:00 would be Timezone (-4*60).
Definition at line 138 of file Timezone.cpp.
Can generate "GMT" or AsHMM(false) above.
Definition at line 146 of file Timezone.cpp.
Timezone::BiasInMinutesFromUTCType Timezone::GetBiasInMinutesFromUTC | ( | const Date & | date, |
const TimeOfDay & | tod | ||
) | const |
Depending on the form of the timezone, the offset from UTC could depend on the date (cuz of daylight savings time)
This offset (number of minutes) - is added to a UTC time to get the time in that local timezone.
Definition at line 156 of file Timezone.cpp.
make_signed_t< time_t > Stroika::Foundation::Time::Timezone::GetBiasFromUTC | ( | const Date & | date, |
const TimeOfDay & | tod | ||
) | const |
Depending on the form of the timezone, the offset from UTC could depend on the date (cuz of daylight savings time)
This offset (number of seconds) - is added to a UTC time to get the time in that local timezone.
Definition at line 37 of file Timezone.inl.
optional< bool > Timezone::IsDaylightSavingsTime | ( | const Date & | date, |
const optional< TimeOfDay > & | tod | ||
) |
For some kinds of timezones, there is no way to know (e.g. +4:00), but return true if known true, and false if known false.
Definition at line 175 of file Timezone.cpp.
Characters::String Timezone::ToString | ( | ) | const |
Definition at line 186 of file Timezone.cpp.
|
staticconstexpr |
According to https://en.wikipedia.org/wiki/List_of_UTC_time_offsets, these actually vary from -12, to 14. But logically, the only thing really crazy would be > 24 or < -24 hours.
Definition at line 120 of file Timezone.h.
|
staticconstexpr |
Returns Timezone object in UTC timezone.
Definition at line 144 of file Timezone.h.
|
staticconstexpr |
Returns Timezone object in localtime timezone.
Definition at line 153 of file Timezone.h.
|
staticconstexpr |
Returns Timezone object in localtime timezone.
Definition at line 159 of file Timezone.h.