tntdb  1.3
tntdb::Time Class Reference

This class holds a time. More...

#include <time.h>

Public Member Functions

 Time ()
 Initializes the Time-object with empty values. More...
 
 Time (unsigned short hour_, unsigned short minute_, unsigned short second_, unsigned short millis_=0)
 Initializes the Time-object with the given values. More...
 
unsigned short getHour () const
 Returns the hour-part of the Time. More...
 
unsigned short getMinute () const
 Returns the minute-part of the Time. More...
 
unsigned short getSecond () const
 Returns the second-part of the Time. More...
 
unsigned short getMillis () const
 Returns the millisecond-part of the Time. More...
 
bool isNull () const
 
void set (unsigned short hour_, unsigned short minute_, unsigned short second_, unsigned short millis_=0)
 Sets the time. More...
 
std::string getIso () const
 Returns the time in ISO-format (hh:mm:ss.hhh) More...
 
bool operator== (const Time &dt) const
 
bool operator!= (const Time &dt) const
 
bool operator< (const Time &dt) const
 
bool operator> (const Time &dt) const
 
bool operator<= (const Time &dt) const
 
bool operator>= (const Time &dt) const
 

Static Public Member Functions

static Time localtime ()
 
static Time gmtime ()
 
static Time fromIso (const std::string &s)
 Interprets the passed string as a time-string in ISO-format (hh:mm:ss.hhh) and returns a Time-object. More...
 

Detailed Description

This class holds a time.

Constructor & Destructor Documentation

tntdb::Time::Time ( )
inline

Initializes the Time-object with empty values.

tntdb::Time::Time ( unsigned short  hour_,
unsigned short  minute_,
unsigned short  second_,
unsigned short  millis_ = 0 
)
inline

Initializes the Time-object with the given values.

No range-checks are done.

Member Function Documentation

static Time tntdb::Time::fromIso ( const std::string &  s)
static

Interprets the passed string as a time-string in ISO-format (hh:mm:ss.hhh) and returns a Time-object.

When the string is not in ISO-format, a exception of type tntdb::TypeError is thrown.

unsigned short tntdb::Time::getHour ( ) const
inline

Returns the hour-part of the Time.

std::string tntdb::Time::getIso ( ) const

Returns the time in ISO-format (hh:mm:ss.hhh)

unsigned short tntdb::Time::getMillis ( ) const
inline

Returns the millisecond-part of the Time.

unsigned short tntdb::Time::getMinute ( ) const
inline

Returns the minute-part of the Time.

unsigned short tntdb::Time::getSecond ( ) const
inline

Returns the second-part of the Time.

void tntdb::Time::set ( unsigned short  hour_,
unsigned short  minute_,
unsigned short  second_,
unsigned short  millis_ = 0 
)
inline

Sets the time.

No range-checks are done.


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