TZ-Lib  $VERSION$
TimeZoneLib Namespace Reference

Classes

class  PosixRule
 
class  TZFile
 
class  TZRule
 

Functions

qint64 dateTime2stamp (qint64 days, quint8 h, quint8 m, quint8 s)
 
qint64 dateTime2stamp (int y, quint8 mon, quint8 day, quint8 hr, quint8 min, quint8 s)
 
qint64 daysSinceEpoch (int year, int month=1, int day=1)
 
qint64 decodeInt (const QByteArray &a, int s=4)
 
qint64 decodeInt64 (const QByteArray &a)
 
qint64 fdiv (qint64 num, qint64 div)
 
qint64 firstWeekDayOf (int year, int month, int wday)
 
TZLIB_EXPORT TZFilegetRegistryZone (QString zn)
 
bool isLeapYear (int year)
 
qint64 lastWeekDayOf (int year, int month, int wday)
 
void offset2Date (qint64 off, qint16 &y, quint8 &m, quint8 &d)
 
int pmod (qint64 num, int mod)
 
void setSystemZoneFile (QString)
 
void stamp2Date (qint64 off, qint16 &y, quint8 &m, quint8 &d)
 
void stamp2Time (qint64 stamp, quint8 &h, quint8 &m, quint8 &s)
 
QString systemDefaultDiscover ()
 
int weekDayOf (int year, int month=1, int day=1)
 
int weekDaySinceEpoch (qint64 daySinceEpoch)
 

Variables

static const qint64 SecondsPerDay =86400
 

Function Documentation

qint64 TimeZoneLib::dateTime2stamp ( qint64  days,
quint8  h,
quint8  m,
quint8  s 
)
inline

converts date and time to a time stamp, UTC is assumed

Parameters
daysthe date in days since Epoch
h:m:sexact time of the day (0<=h<24)

References SecondsPerDay.

Referenced by dateTime2stamp(), and TimeStamp::moveToZone().

qint64 TimeZoneLib::dateTime2stamp ( int  y,
quint8  mon,
quint8  day,
quint8  hr,
quint8  min,
quint8  s 
)
inline

converts date and time to a time stamp, UTC is assumed

Parameters
yyear
monthe month (1-12)
dayday of the month (1-31)
hr:min:sexact time of the day (0<=hr<24)

References dateTime2stamp(), and daysSinceEpoch().

qint64 TimeZoneLib::daysSinceEpoch ( int  year,
int  month = 1,
int  day = 1 
)
inline

returns how many days have passed since Epoch to this day

Returns
0 for 1/1/1970, positive values after Epoch, negative values befor Epoch
Parameters
yearthe year to be calculated
monththe month to be calculates, must be between 1 and 12, assumes january if none given
daythe day of the month to be calculated, must be between 1 and 31, assumes the 1st if none given

References isLeapYear().

Referenced by calcTimeStamp(), dateTime2stamp(), firstWeekDayOf(), lastWeekDayOf(), TimeZoneLib::PosixRule::rulesForYear(), and weekDayOf().

qint64 TimeZoneLib::decodeInt ( const QByteArray &  a,
int  s = 4 
)
inline

decodes a signed big endian integer from a byte array, per default it decodes a 32bit int

Parameters
athe array, it must be at least s bytes long
sthe length of the int in bytes

Referenced by decodeInt64().

qint64 TimeZoneLib::decodeInt64 ( const QByteArray &  a)
inline

convenience function: decodes a 64bit integer from an array, see decodeInt

References decodeInt().

qint64 TimeZoneLib::fdiv ( qint64  num,
qint64  div 
)
inline

Referenced by TimeStamp::addMSecs(), and stamp2Date().

qint64 TimeZoneLib::firstWeekDayOf ( int  year,
int  month,
int  wday 
)
inline

returns the first day in a month that is a specific day of the week, 0 and 7 are sunday

Returns
offset in days from Epoch

References daysSinceEpoch(), pmod(), and weekDaySinceEpoch().

bool TimeZoneLib::isLeapYear ( int  year)
inline

returns true if the given year is a leap year according to the Gregorian calendar

Referenced by calcTimeStamp(), daysSinceEpoch(), and offset2Date().

qint64 TimeZoneLib::lastWeekDayOf ( int  year,
int  month,
int  wday 
)
inline

returns the last day in a month that is a specific day of the week, 0 and 7 are sunday

Returns
offset in days from Epoch

References daysSinceEpoch(), pmod(), and weekDaySinceEpoch().

Referenced by calcTimeStamp().

void TimeZoneLib::offset2Date ( qint64  off,
qint16 &  y,
quint8 &  m,
quint8 &  d 
)
inline

returns the date represented by this offset from Epoch (in days)

References isLeapYear().

Referenced by stamp2Date().

int TimeZoneLib::pmod ( qint64  num,
int  mod 
)
inline
void TimeZoneLib::setSystemZoneFile ( QString  z)

References systemZone.

Referenced by systemDefaultDiscover().

void TimeZoneLib::stamp2Date ( qint64  off,
qint16 &  y,
quint8 &  m,
quint8 &  d 
)
inline

converts the time stamp to a date (assumes UTC)

References fdiv(), and offset2Date().

Referenced by TimeZoneLib::PosixRule::nextRule(), TimeZoneLib::PosixRule::ruleForLocalTime(), and TimeZoneLib::PosixRule::ruleForTime().

void TimeZoneLib::stamp2Time ( qint64  stamp,
quint8 &  h,
quint8 &  m,
quint8 &  s 
)
inline

returns the time represented by this unix timestamp for UTC

References pmod().

QString TimeZoneLib::systemDefaultDiscover ( )
int TimeZoneLib::weekDayOf ( int  year,
int  month = 1,
int  day = 1 
)
inline

returns the week day of a specific date

Returns
0 for sunday, 1 for monday, ...etc., 6 for saturday
Parameters
yearthe year to be calculated
monththe month to be calculates, must be between 1 and 12, assumes january if none given
daythe day of the month to be calculated, must be between 1 and 31, assumes the 1st if none given

References daysSinceEpoch(), and pmod().

Referenced by TimeStamp::weekDay().

int TimeZoneLib::weekDaySinceEpoch ( qint64  daySinceEpoch)
inline

returns the week day of a specific day offset from Epoch

Returns
0 for sunday, 1 for monday, ...etc., 6 for saturday

References pmod().

Referenced by firstWeekDayOf(), and lastWeekDayOf().

Variable Documentation

const qint64 TimeZoneLib::SecondsPerDay =86400
static