Public Member Functions

Barry::TimeZone Class Reference

Collaboration diagram for Barry::TimeZone:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TimeZone (int utc_offset)
 Creates a new timezone based on utc_offset minutes.
 TimeZone (int hours, int minutes)
 Creates a new timezone based on negative/positive hours, and positive minutes.
void Split (int *hours, int *minutes) const
 Splits UTCOffset minutes into hours and minutes.
void SplitAbsolute (bool *west, unsigned int *hours, unsigned int *minutes) const
 Splits UTCOffset minutes into absolute values of hours and minutes, and sets the west flag appropriately.
std::string GetTz (const std::string &prefix) const
 Creates a timezone string suitable for a Unix / POSIX TZ environment variable.

Detailed Description

Definition at line 37 of file r_timezone.h.


Constructor & Destructor Documentation

Barry::TimeZone::TimeZone ( int  utc_offset  )  [explicit]

Creates a new timezone based on utc_offset minutes.

Use same semantics as UTCOffset. For example, a -3.5 hour timezone (which is west of UTC) would be constructed as: TimeZone(-210)

Definition at line 67 of file r_timezone.cc.

Barry::TimeZone::TimeZone ( int  hours,
int  minutes 
)

Creates a new timezone based on negative/positive hours, and positive minutes.

For example, a -3.5 hour timezone (which is west of UTC) would be constructed as: TimeZone(-3, 30) Note that minutes can be negative, and it will be handled correctly. i.e. TimeZone(-3, 30) == TimeZone(-3, -30)

Definition at line 74 of file r_timezone.cc.


Member Function Documentation

std::string Barry::TimeZone::GetTz ( const std::string &  prefix  )  const

Creates a timezone string suitable for a Unix / POSIX TZ environment variable.

Expects a time zone prefix. For example, New Zealand Standard/Daylight Time is NZST/NZDT, so the prefix would be "NZ". Eastern Standard/Daylight Time is EST/EDT, so the prefix would be "E".

Should be able to use this string to achieve time zone conversions using the TzWrapper class.

Definition at line 331 of file r_timezone.cc.

References Split().

Here is the call graph for this function:

void Barry::TimeZone::Split ( int *  hours,
int *  minutes 
) const

Splits UTCOffset minutes into hours and minutes.

hours can be negative. minutes is always positive.

Definition at line 304 of file r_timezone.cc.

Referenced by GetTz(), and SplitAbsolute().

Here is the caller graph for this function:

void Barry::TimeZone::SplitAbsolute ( bool *  west,
unsigned int *  hours,
unsigned int *  minutes 
) const

Splits UTCOffset minutes into absolute values of hours and minutes, and sets the west flag appropriately.

This is to mimic the old behaviour of the Left, Offset and OffsetFraction member variables.

Definition at line 312 of file r_timezone.cc.

References Split().

Here is the call graph for this function:


The documentation for this class was generated from the following files: