tntdb 1.4
tntdb::Time Class Reference

This class holds a time. More...

#include <time.h>

Public Member Functions

 Time ()
 Create a Time object with empty values.
 
 Time (unsigned short hour, unsigned short minute, unsigned short second, unsigned short millis=0)
 Create a Time object with the given values.
 
unsigned short getHour () const
 Get the hour part of the Time.
 
unsigned short getMinute () const
 Get the minute part of the Time.
 
unsigned short getSecond () const
 Get the second part of the Time.
 
unsigned short getMillis () const
 Get the millisecond part of the Time.
 
bool isNull () const
 
void set (unsigned short hour, unsigned short minute, unsigned short second, unsigned short millis=0)
 Sets the time.
 
std::string getIso () const
 Get the time in ISO format (hh:mm:ss.hhh)
 
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)
 Construct a Time object from the given ISO date string.
 

Detailed Description

This class holds a time.

Constructor & Destructor Documentation

◆ Time() [1/2]

tntdb::Time::Time ( )
inline

Create a Time object with empty values.

◆ Time() [2/2]

tntdb::Time::Time ( unsigned short hour,
unsigned short minute,
unsigned short second,
unsigned short millis = 0 )
inline

Create a Time object with the given values.

No range checks are done.

Member Function Documentation

◆ fromIso()

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

Construct a Time object from the given ISO date string.

If the string is not in ISO format, an exception of type tntdb::TypeError is thrown.

◆ getHour()

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

Get the hour part of the Time.

◆ getIso()

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

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

◆ getMillis()

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

Get the millisecond part of the Time.

◆ getMinute()

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

Get the minute part of the Time.

◆ getSecond()

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

Get the second part of the Time.

◆ set()

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: