Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

CTBtime Class Reference

Calendar time representation. More...

#include "CTBtime.hxx"

List of all members.

Public Methods

 CTBtime ()
 CTBtime (double d_time)
void GetSystemTime ()
void Split (CTBint32 &i_sec, CTBint32 &i_usec) const
bool Valid () const
CTBint32 UnixTime () const
void ToStream (ostream &os) const
void FromStream (istream &is)
bool operator! () const
CTBtime & operator= (double d_time)
CTBtime & operator+= (double d_delta)
CTBtime & operator-= (double d_delta)
 operator double () const

Static Public Methods

CTBint32 ymdhms2ui (int i_year, int i_month, int i_day, int i_hour, int i_min, int i_sec)
CTBint32 vms2ui (const char *c_time)
void ui2local (char *c_time, int i_size, const char *c_format, CTBint32 i_time)
void ui2utc (char *c_time, int i_size, const char *c_format, CTBint32 i_time)
void ui2vms (char c_time[21], CTBint32 i_time)

Private Attributes

double md_time

Friends

CTBtime operator+ (const CTBtime &time, double d_delta)
CTBtime operator+ (double d_delta, const CTBtime &time)
CTBtime operator- (const CTBtime &time, double d_delta)
double operator- (const CTBtime &lhs, const CTBtime &rhs)
bool operator== (const CTBtime &lhs, const CTBtime &rhs)
bool operator< (const CTBtime &lhs, const CTBtime &rhs)

Related Functions

(Note that these are not member functions.)

ostream & operator<< (ostream &os, const CTBtime &obj)
istream & operator>> (istream &is, CTBtime &obj)


Detailed Description

Calendar time representation.

The class CTBtime represents `calendar time'. The internal representation is accurate to a microsecond and allows to do time arithmetic in an efficient fashion. A CTBtime can be converted into a double holding an `absolute time' in the form of the number of seconds elapsed since the UNIX epoch, 00:00:00 on January 1, 1970, UTC.

Definition at line 16 of file CTBtime.hxx.


Constructor & Destructor Documentation

CTBtime::CTBtime [inline]
 

Default constructor, sets time to invalid.

Definition at line 19 of file CTBtime.icc.

CTBtime::CTBtime double d_time [inline]
 

Construct from absolute time.

Definition at line 26 of file CTBtime.icc.


Member Function Documentation

void CTBtime::GetSystemTime
 

Get system time.

Definition at line 44 of file CTBtime.cxx.

void CTBtime::Split CTBint32 & i_sec,
CTBint32 & i_usec
const
 

Split time in second since epoch and fractional second parts.

Definition at line 60 of file CTBtime.cxx.

Referenced by CTBtimeParsed::ParseTime().

bool CTBtime::Valid const [inline]
 

Returns true if time valid.

Definition at line 33 of file CTBtime.icc.

Referenced by CTBtimeParsed::ParseTime(), CTBxmlOStream::PutTaggedValue(), Split(), and operator!().

CTBint32 CTBtime::UnixTime const [inline]
 

Returns time as integer number of seconds since the Unix epoch.

Definition at line 41 of file CTBtime.icc.

void CTBtime::ToStream ostream & os const
 

ostream insertion, uses CTBtimeParsed::ToStream() .

Definition at line 84 of file CTBtime.cxx.

Referenced by operator<<().

void CTBtime::FromStream istream & is
 

istream extraction, uses CTBtimeParsed::FromStream() .

Definition at line 94 of file CTBtime.cxx.

Referenced by operator>>().

bool CTBtime::operator! const [inline]
 

Returns true if time not valid.

Definition at line 49 of file CTBtime.icc.

CTBtime & CTBtime::operator= double d_time [inline]
 

Set to absolute time.

Definition at line 57 of file CTBtime.icc.

CTBtime & CTBtime::operator+= double d_delta [inline]
 

Add delta time.

Definition at line 66 of file CTBtime.icc.

CTBtime & CTBtime::operator-= double d_delta [inline]
 

Subtract delta time.

Definition at line 75 of file CTBtime.icc.

CTBtime::operator double const [inline]
 

Convert to absolute time.

Definition at line 84 of file CTBtime.icc.

CTBint32 CTBtime::ymdhms2ui int i_year,
int i_month,
int i_day,
int i_hour,
int i_min,
int i_sec
[static]
 

Convert from ymdhms to unix int.

Converts a time specified with i_year, ..., i_sec to a UNIX int time. The arguments have the meaning:

  • i_year - year (with century, like 1998)
  • i_month - month (1=jan,..,12=dec)
  • i_day - day in month (1,...,31)
  • i_hour - hour (0,..,23)
  • i_min - minute (0,..,59)
  • i_sec - second (0,..,59)

Definition at line 117 of file CTBtime.cxx.

Referenced by vms2ui().

CTBint32 CTBtime::vms2ui const char * c_time [static]
 

Convert VMS time string to UNIX int time.

Definition at line 151 of file CTBtime.cxx.

void CTBtime::ui2local char * c_time,
int i_size,
const char * c_format,
CTBint32 i_time
[static]
 

Convert int to local time string.

The time i_time, given as UNIX int time, is converted using the format c_format into a character string stored in c_time with a maximal length of i_size. The format c_format is in strftime format.

Definition at line 228 of file CTBtime.cxx.

Referenced by ui2vms().

void CTBtime::ui2utc char * c_time,
int i_size,
const char * c_format,
CTBint32 i_time
[static]
 

Convert int to UTC time string.

The time i_time, given as UNIX int time, is converted using the format c_format into a character string stored in c_time with a maximal length of i_size. The format c_format is in strftime format.

Definition at line 247 of file CTBtime.cxx.

void CTBtime::ui2vms char c_time[21],
CTBint32 i_time
[static]
 

Convert int to VMS time string.

The time i_time, given as UNIX int time, is converted into a character string in VMS time format "dd-mmm-yyyy hh:mm:ss" and stored in c_time.

Definition at line 265 of file CTBtime.cxx.


Friends And Related Function Documentation

CTBtime operator+ const CTBtime & time,
double d_delta
[friend]
 

Add a delta time d_delta to a time.

Definition at line 95 of file CTBtime.icc.

CTBtime operator+ double d_delta,
const CTBtime & time
[friend]
 

Add a delta time d_delta to a time.

Definition at line 106 of file CTBtime.icc.

CTBtime operator- const CTBtime & time,
double d_delta
[friend]
 

Subtract a delta time d_delta from a calendar time.

Definition at line 117 of file CTBtime.icc.

double operator- const CTBtime & lhs,
const CTBtime & rhs
[friend]
 

Subtract two calendar times, resulting in a delta time in seconds.

Definition at line 128 of file CTBtime.icc.

bool operator== const CTBtime & lhs,
const CTBtime & rhs
[friend]
 

Returns true if both times are equal.

Definition at line 139 of file CTBtime.icc.

bool operator< const CTBtime & lhs,
const CTBtime & rhs
[friend]
 

Returns true if lhs temporal earlier than rhs.

Definition at line 150 of file CTBtime.icc.

ostream & operator<< ostream & os,
const CTBtime & obj
[related]
 

ostream insertion operator, forwards to ToStream() .

Definition at line 161 of file CTBtime.icc.

istream & operator>> istream & is,
CTBtime & obj
[related]
 

istream extraction operator, forwards to FromStream() .

Definition at line 173 of file CTBtime.icc.


Member Data Documentation

double CTBtime::md_time [private]
 

time in sec since epoch.

Definition at line 61 of file CTBtime.hxx.


The documentation for this class was generated from the following files:
Generated at Fri Oct 24 18:14:11 2003 for CTBbase by doxygen1.2.9-20010812 written by Dimitri van Heesch, © 1997-2001