CppCommon
1.0.4.1
C++ Common Library
|
#include <timezone.h>
Public Member Functions | |
Timezone () | |
Initialize timezone with a current local timezone. More... | |
Timezone (const std::string &name, const Timespan &offset, const Timespan &dstoffset=Timespan::zero()) | |
Initialize timezone with a given local time offset and daylight saving time offset. More... | |
Timezone (const Timezone &)=default | |
Timezone (Timezone &&)=default | |
~Timezone ()=default | |
Timezone & | operator= (const Timezone &)=default |
Timezone & | operator= (Timezone &&)=default |
const std::string & | name () const noexcept |
Get timezone name. More... | |
const Timespan & | offset () const noexcept |
Get timezone offset. More... | |
const Timespan & | daylight () const noexcept |
Get timezone daylight saving time offset. More... | |
Timespan | total () const noexcept |
Get timezone total offset. More... | |
LocalTime | Convert (const UtcTime &utctime) const |
Convert UTC time to local time using the current timezone. More... | |
UtcTime | Convert (const LocalTime &localtime) const |
Convert local time to UTC time using the current timezone. More... | |
void | swap (Timezone &timezone) noexcept |
Swap two instances. More... | |
Static Public Member Functions | |
static Timezone | utc () |
Get the UTC timezone (Greenwich Mean Time) More... | |
static Timezone | local () |
Get the local timezone. More... | |
Protected Attributes | |
std::string | _name |
Timezone name. More... | |
Timespan | _offset |
Timezone offset. More... | |
Timespan | _dstoffset |
Timezone daylight saving time offset. More... | |
Friends | |
bool | operator== (const Timezone &timezone1, const Timezone &timezone2) noexcept |
bool | operator!= (const Timezone &timezone1, const Timezone &timezone2) noexcept |
bool | operator> (const Timezone &timezone1, const Timezone &timezone2) noexcept |
bool | operator< (const Timezone &timezone1, const Timezone &timezone2) noexcept |
bool | operator>= (const Timezone &timezone1, const Timezone &timezone2) noexcept |
bool | operator<= (const Timezone &timezone1, const Timezone &timezone2) noexcept |
void | swap (Timezone &timezone1, Timezone &timezone2) noexcept |
Timezone wraps the current timezone and dynamic daylight saving time settings.
Not thread-safe.
Definition at line 24 of file timezone.h.
CppCommon::Timezone::Timezone | ( | ) |
Initialize timezone with a current local timezone.
Definition at line 19 of file timezone.cpp.
|
inlineexplicit |
Initialize timezone with a given local time offset and daylight saving time offset.
name | - Timezone name |
offset | - Local time offset |
dstoffset | - Daylight saving time offset (default is Timespan::zero()) |
Definition at line 35 of file timezone.h.
|
default |
|
default |
|
default |
Convert local time to UTC time using the current timezone.
localtime | - Local time |
Definition at line 81 of file timezone.h.
Convert UTC time to local time using the current timezone.
utctime | - UTC time |
Definition at line 74 of file timezone.h.
|
inlinenoexcept |
Get timezone daylight saving time offset.
Definition at line 64 of file timezone.h.
|
inlinestatic |
Get the local timezone.
Thread-safe.
Definition at line 99 of file timezone.h.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Swap two instances.
Definition at line 11 of file timezone.inl.
|
inlinenoexcept |
Get timezone total offset.
Definition at line 67 of file timezone.h.
|
inlinestatic |
Get the UTC timezone (Greenwich Mean Time)
Thread-safe.
Definition at line 90 of file timezone.h.
Definition at line 48 of file timezone.h.
Definition at line 52 of file timezone.h.
Definition at line 56 of file timezone.h.
Definition at line 46 of file timezone.h.
Definition at line 50 of file timezone.h.
Definition at line 54 of file timezone.h.
Definition at line 19 of file timezone.inl.
|
protected |
Timezone daylight saving time offset.
Definition at line 112 of file timezone.h.
|
protected |
Timezone name.
Definition at line 108 of file timezone.h.
|
protected |
Timezone offset.
Definition at line 110 of file timezone.h.