FX::FXTime Struct Reference

#include <FXTime.h>

List of all members.


Detailed Description

Holds the number of elapsed microseconds since 1st January year 0 UTC.

Given that there are 1,000,000 microseconds in a second and roughly 365.24119241192411924119241192412 days in a year, there are roughly 31,556,839,024,390 microseconds in a year. This means that an unsigned 64 bit container can hold the latest date of 20th February, year 584,556 which is probably enough.

FXTime knows when it is in local time and correctly serialises itself such that timezone translation correctly occurs.

Public Member Functions

 FXTime (FXulong _value=0, bool _isLocalTime=false)
 FXTime (time_t ctime)
 FXTime (int ctime)
FXTimeoperator= (FXulong _value)
FXTimeoperator= (time_t ctime)
FXTimeoperator= (int ctime)
bool operator! () const throw ()
bool operator== (const FXTime &o) const throw ()
bool operator!= (const FXTime &o) const throw ()
bool operator< (const FXTime &o) const throw ()
bool operator> (const FXTime &o) const throw ()
FXTimeoperator+= (const FXTime &b) throw ()
FXTimeoperator+= (FXulong v) throw ()
FXTimeoperator-= (const FXTime &b) throw ()
FXTimeoperator-= (FXulong v) throw ()
time_t as_time_t () const throw ()
FXTimeset_time_t (time_t v) throw ()
struct tm * as_tm (struct tm *buf, bool inLocalTime=false) const
FXTimeset_tm (struct tm *buf, bool isInLocalTime=false)
FXString asString (const FXString &fmt="%Y/%m/%d %H:%M:%S.%F %Z") const
FXTimetoLocalTime ()
FXTimetoUTC ()

Static Public Member Functions

static FXTime now (bool inLocalTime=false)
static FXlong localTimeDiff ()

Public Attributes

bool isLocalTime
FXulong value

Static Public Attributes

static const FXulong micsPerSecond
static const FXulong micsPerYear
static const FXulong mics1stJan1601
static const FXulong mics1stJan1970

Friends

FXTime operator+ (const FXTime &a, const FXTime &b) throw ()
FXTime operator+ (const FXTime &a, FXulong v) throw ()
FXTime operator- (const FXTime &a, const FXTime &b) throw ()
FXTime operator- (const FXTime &a, FXulong v) throw ()
FXAPI FXStreamoperator<< (FXStream &s, const FXTime &i)
FXAPI FXStreamoperator>> (FXStream &s, FXTime &i)


Constructor & Destructor Documentation

FX::FXTime::FXTime ( FXulong  _value = 0,
bool  _isLocalTime = false 
) [inline, explicit]

Constructs an instance.

FX::FXTime::FXTime ( time_t  ctime  )  [inline, explicit]

Constructs an instance from a time_t.


Member Function Documentation

time_t FX::FXTime::as_time_t (  )  const throw () [inline]

Returns the value as a time_t.

FXTime& FX::FXTime::set_time_t ( time_t  v  )  throw () [inline]

Sets the value from a time_t.

struct tm* FX::FXTime::as_tm ( struct tm *  buf,
bool  inLocalTime = false 
) const [read]

Returns the value as a struct tm.

FXTime& FX::FXTime::set_tm ( struct tm *  buf,
bool  isInLocalTime = false 
)

Sets the value from a struct tm.

FXString FX::FXTime::asString ( const FXString fmt = "%Y/%m/%d %H:%M:%S.%F %Z"  )  const

Returns the time as a string of format fmt. The formatting inserts are as for strftime in the C library except that F means microsecond fraction of the form 999999 or 000001 which would mean 0.999999 or 0.000001 of a second

FXTime& FX::FXTime::toLocalTime (  )  [inline]

Converts time to local time if it isn't already.

FXTime& FX::FXTime::toUTC (  )  [inline]

Converts time from local time to UTC if it isn't already.

static FXTime FX::FXTime::now ( bool  inLocalTime = false  )  [static]

Returns this present moment.

static FXlong FX::FXTime::localTimeDiff (  )  [static]

Returns how much to add or subtract to convert UTC to local time.


Member Data Documentation

const FXulong FX::FXTime::micsPerSecond [static]

The number of microseconds per second.

const FXulong FX::FXTime::micsPerYear [static]

The number of microseconds per year.

const FXulong FX::FXTime::mics1stJan1601 [static]

The number of microseconds that was midnight 1st January 1601 UTC.

const FXulong FX::FXTime::mics1stJan1970 [static]

The number of microseconds that was midnight 1st January 1970 UTC.

Whether this time is in local time.

The number of elapsed microseconds since midnight 1st January year 0 UTC.


The documentation for this struct was generated from the following file:

(C) 2002-2008 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Jun 13 22:21:28 2008 for TnFOX by doxygen v1.5.6