CoreComponents 3.0.0
A Modern C++ Toolkit
Loading...
Searching...
No Matches
Timezone Class Referencefinal

Timezone information More...

#include <cc/Timezone>

Inheritance diagram for Timezone:

Classes

class  FormatError
 Failed to parse timezone information file. More...
 

Public Types

using Item = TimeInfo
 Timezone information record
 

Public Member Functions

 Timezone ()=default
 Create a null timezone file.
 
 Timezone (const String &data)
 Load timezone information from data (RFC 8536 format)
 
long count () const
 Number of time information entries
 
const TimeInfoat (long i) const
 Get time information entry at i.
 
const TimeInfooperator[] (long i) const
 Get time information entry at i.
 
const TimeInfoinfoForTime (double time) const
 Get time zone information for time.
 
int operator() (double time) const
 Get UTF offset for time.
 
- Public Member Functions inherited from Object
 Object ()=default
 Create a null object.
 
 operator bool () const
 Check if this is a non-null object.
 
bool isNull () const
 Check if this is a null object.
 
template<class T >
bool is () const
 Check if this object is of type T.
 
template<class T >
as () const
 Cast this object to type T.
 
bool isWeak () const
 Check if the underlying object reference is weak.
 
bool operator== (const Object &other) const
 Equality operator.
 
std::strong_ordering operator<=> (const Object &other) const
 Ordering operator.
 
long useCount () const
 Reference count.
 

Static Public Member Functions

static Timezone local ()
 Get local timezone information.
 
static int offset (double time)
 Get the local UTC offset for time (in seconds)
 
static Date date (double time)
 Create the local calendar date by breaking down time.
 
static Date currentDate ()
 Create the local calendar date of the current system time.
 
static double nextTime (const Date &date, int hour, int minutes=0, int seconds=0)
 Get the next time matching the given day time.
 
static Timezone loadFromFile (const String &path)
 Load timezone information from path.
 
using value_type = TimeInfo
 
using size_type = long
 
using const_iterator = ArrayIterator<const Timezone, 1>
 
using const_reverse_iterator = ArrayIterator<const Timezone, -1>
 
const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator end () const
 
const_iterator cend () const
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator rend () const
 
const_reverse_iterator crend () const
 

Additional Inherited Members

- Protected Member Functions inherited from Object
template<class T >
weak () const
 
template<class T >
void initOnce ()
 Create the object state when called the first time.
 
template<class T >
void initOncePerThread ()
 Create a distinct object state for each thread when called the first time in that thread.
 
 Object (State *newState)
 Initialize object with newState.
 
 Object (State *state, Alias)
 
 Object (State *state, Weak)
 
Objectoperator= (std::nullptr_t)
 
- Static Protected Member Functions inherited from Object
template<class T >
static T alias (const State *state)
 Create an alias object for the given state.
 
template<class T >
static T weak (const State *state)
 
- Protected Attributes inherited from Object
Handle< Stateme
 Internal object state
 

Detailed Description

Timezone information

See also
Date

Member Typedef Documentation

◆ Item

using Item = TimeInfo

Timezone information record

Constructor & Destructor Documentation

◆ Timezone() [1/2]

Timezone ( )
default

Create a null timezone file.

◆ Timezone() [2/2]

Timezone ( const String & data)
explicit

Load timezone information from data (RFC 8536 format)

Exceptions
FormatError
InputExhaustion

Member Function Documentation

◆ local()

Timezone local ( )
static

Get local timezone information.

◆ offset()

static int offset ( double time)
static

Get the local UTC offset for time (in seconds)

◆ date()

static Date date ( double time)
static

Create the local calendar date by breaking down time.

◆ currentDate()

Date currentDate ( )
static

Create the local calendar date of the current system time.

◆ nextTime()

double nextTime ( const Date & date,
int hour,
int minutes = 0,
int seconds = 0 )
static

Get the next time matching the given day time.

Parameters
dateDate in the local timezone.
hourHour of the day (0..23)
minutesMinutes (0..60)
secondsSeconds (0..60)
Returns
The next time the local time hits the given day time

This method computes the next time at which the local time hits the giving hour, minutes and seconds. The local timezone and eventual change in daylight saving time is taken into account.

◆ loadFromFile()

Timezone loadFromFile ( const String & path)
static

Load timezone information from path.

Exceptions
SystemError
FormatError
InputExhaustion

◆ count()

long count ( ) const

Number of time information entries

◆ at()

const TimeInfo & at ( long i) const

Get time information entry at i.

◆ operator[]()

const TimeInfo & operator[] ( long i) const

Get time information entry at i.

◆ infoForTime()

const TimeInfo & infoForTime ( double time) const

Get time zone information for time.

◆ operator()()

int operator() ( double time) const

Get UTF offset for time.