libdballe 9.6
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
dballe::Time Struct Reference

Time of the day. More...

#include <types.h>

Public Member Functions

 Time ()
 Construct a missing time.
 
 Time (int ho, int mi=0, int se=0)
 Construct from broken down values.
 
 Time (const Time &t)=default
 
bool is_missing () const
 Check if this time is the missing value.
 
void to_stream_iso8601 (std::ostream &out) const
 Write the time to an output stream in ISO8601 extended format (hh:mm:ss).
 
void to_csv_iso8601 (CSVWriter &out) const
 Write the time as a CSV field in ISO8601 date format.
 
int compare (const Time &other) const
 Generic comparison.
 
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 void validate (int ho, int mi, int se)
 Raise an exception if the three values do not represent a valid time.
 

Public Attributes

unsigned char hour
 
unsigned char minute
 
unsigned char second
 

Detailed Description

Time of the day.

If hour is 0xff, then all the time is considered missing. Else, all fields must be set.

Constructor & Destructor Documentation

◆ Time()

dballe::Time::Time ( int  ho,
int  mi = 0,
int  se = 0 
)

Construct from broken down values.

A hour of MISSING_INT constructs a missing Time. In any other case, arguments are validated with Time::validate().

Member Function Documentation

◆ compare()

int dballe::Time::compare ( const Time other) const

Generic comparison.

Returns a negative number if *this < other Returns zero if *this == other Returns a positive number if *this > other

◆ validate()

static void dballe::Time::validate ( int  ho,
int  mi,
int  se 
)
static

Raise an exception if the three values do not represent a valid time.

A value of 23:59:60 is allowed to accomodate for times during leap seconds.


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