Evo C++ Library v0.5.1
|
#include <evo/time.h>
Structure holding a time zone offset from UTC.
Public Member Functions | |
TimeZoneOffset () | |
Constructor to set as null (no time zone). More... | |
TimeZoneOffset (int minutes) | |
Constructor to initialize with a time zone offset in minutes. More... | |
TimeZoneOffset (int hours, int hour_minutes) | |
Constructor to initialize with a time zone offset from hours and minutes. More... | |
TimeZoneOffset (const TimeZoneOffset &src) | |
Copy constructor. More... | |
int | compare (const TimeZoneOffset &oth) const |
Compare to another time zone offset. More... | |
template<class T > | |
T & | format (T &out, char delim=':', bool allow_z=true) const |
Format timezone offset to String or Stream. More... | |
bool | null () const |
Get whether time zone offset is null (not set). More... | |
bool | operator!= (const TimeZoneOffset &oth) const |
Compare for inequality with another time of day. More... | |
bool | operator< (const TimeZoneOffset &oth) const |
Compare whether less than another time of day. More... | |
bool | operator<= (const TimeZoneOffset &oth) const |
Compare whether less than or equal to another time of day. More... | |
TimeZoneOffset & | operator= (const TimeZoneOffset &src) |
Assignment operator. More... | |
bool | operator== (const TimeZoneOffset &oth) const |
Compare for equality with another time of day. More... | |
bool | operator> (const TimeZoneOffset &oth) const |
Compare whether greater than another time of day. More... | |
bool | operator>= (const TimeZoneOffset &oth) const |
Compare whether greater than or equal to another time of day. More... | |
bool | parse (const SubString &str, bool required=false) |
Set timezone offset from parsing standard timezone offset string. More... | |
bool | parse_std_impl (const char *&inp, const char *end, bool required=false) |
Set timezone offset from parsing standard timezone offset string (used internally). More... | |
void | set () |
Set as null (no time zone). More... | |
bool | set (int new_minutes) |
Set to time zone offset in minutes. More... | |
bool | set (int hours, int hour_minutes) |
Set new time zone offset from hours and minutes. More... | |
TimeZoneOffset & | set_local () |
Set to current time zone offset. More... | |
TimeZoneOffset & | set_utc () |
Set to UTC. More... | |
bool | validate () const |
Validate current timezone offset. More... | |
Public Attributes | |
int | minutes |
Time zone offset from UTC in minutes (-720 - 840), OFFSET_NULL for null, negative for the Western Hemisphere (America), positive for the remaining time zones. More... | |
Static Public Attributes | |
static const int | OFFSET_MAX = 1439 |
Maximum time zone offset in minutes (normally 840 but enforced at 1439) More... | |
static const int | OFFSET_MIN = -1439 |
Minimum time zone offset in minutes (normally -720 but enforced at -1439) More... | |
static const int | OFFSET_NULL = Int::MIN |
Special value for null time zone (null is less than all other values), i.e. no assigned time zone. More... | |
|
inline |
Constructor to set as null (no time zone).
|
inline |
Constructor to initialize with a time zone offset in minutes.
minutes | Time zone offset from UTC in minutes, 0 for UTC, negative for the Western Hemisphere (America), positive for the remaining time zones, OFFSET_NULL for null (no time zone) |
|
inline |
Constructor to initialize with a time zone offset from hours and minutes.
hours | Offset hours (-23 - 23) |
hour_minutes | Offset minutes (0 - 59) |
|
inline |
Copy constructor.
src | Source to copy |
|
inline |
Compare to another time zone offset.
oth | Other time zone to compare to |
|
inline |
Format timezone offset to String or Stream.
Z
if no offset and allow_z=true
+HH:MM
– positive offset with default delimiter, other delimiters may be used but aren't considered standard-HH:MM
– negative offset with default delimiter, other delimiters may be used but aren't considered standard+HHMM
– positive offset without a delimiter-HHMM
– negative offset without a delimiterout | Output String/Stream to format to |
delim | Delimiter to use between fields, usually : or 0 for no delimiter – other values are non-standard |
allow_z | Whether to allow formatting as Z for UTC, false to use +00:00 instead (where : is delim ) |
out
|
inline |
Get whether time zone offset is null (not set).
|
inline |
Compare for inequality with another time of day.
oth | Other time of day to compare to |
|
inline |
Compare whether less than another time of day.
oth | Other time of day to compare to |
|
inline |
Compare whether less than or equal to another time of day.
oth | Other time of day to compare to |
|
inline |
Assignment operator.
src | Source to copy |
|
inline |
Compare for equality with another time of day.
oth | Other time of day to compare to |
|
inline |
Compare whether greater than another time of day.
oth | Other time of day to compare to |
|
inline |
Compare whether greater than or equal to another time of day.
oth | Other time of day to compare to |
|
inline |
Set timezone offset from parsing standard timezone offset string.
Z
or z
if no offset+HH:MM
or -HH:MM
– offset with standard delimiter, other delimiters not supported+HHMM
or -HHMM
– offset without a delimiter+HH
or -HH
– offset with just hoursrequired=false
, or an error if required=true
str | String to parse |
required | Whether a value is required, false if null is ok, true if null is an error |
|
inline |
Set timezone offset from parsing standard timezone offset string (used internally).
Z
or z
if no offset, same if empty or a non-digit character is found that doesn't match the syntax+HH:MM
or -HH:MM
– offset with standard delimiter, other delimiters not supported+HHMM
or -HHMM
– offset without a delimiter+HH
or -HH
– offset with just hoursrequired=false
, or an error if required=true
inp | Start parsing pointer (must be <= end ), set to stop position [in/out] |
end | End of string pointer, must not be NULL |
required | Whether a value is required, false if null is ok, true if null is an error |
required=true
|
inline |
Set as null (no time zone).
|
inline |
Set to time zone offset in minutes.
new_minutes | Time zone offset from UTC in minutes, 0 for UTC, negative for the Western Hemisphere (America), positive for the remaining time zones, OFFSET_NULL for null (no time zone) |
|
inline |
Set new time zone offset from hours and minutes.
hours | Offset hours (-23 - 23) |
hour_minutes | Offset minutes (0 - 59) |
|
inline |
Set to current time zone offset.
|
inline |
Set to UTC.
|
inline |
Validate current timezone offset.
int minutes |
Time zone offset from UTC in minutes (-720 - 840), OFFSET_NULL for null, negative for the Western Hemisphere (America), positive for the remaining time zones.
|
static |
Maximum time zone offset in minutes (normally 840 but enforced at 1439)
|
static |
Minimum time zone offset in minutes (normally -720 but enforced at -1439)
|
static |
Special value for null time zone (null is less than all other values), i.e. no assigned time zone.