xlnt
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
xlnt::time Struct Reference

A time is a specific time of the day specified in terms of an hour, minute, second, and microsecond (0-999999). It can also be initialized as a fraction of a day using time::from_number. More...

#include <time.hpp>

Public Member Functions

 time (int hour_=0, int minute_=0, int second_=0, int microsecond_=0)
 Constructs a time object from an optional hour, minute, second, and microsecond. More...
 
 time (const std::string &time_string)
 Constructs a time object from a string representing the time. More...
 
double to_number () const
 Returns a numeric representation of the time in the range 0-1 where the value is equal to the fraction of the day elapsed. More...
 
bool operator== (const time &comparand) const
 Returns true if this time is equivalent to comparand. More...
 

Static Public Member Functions

static time now ()
 Returns the current time according to the system time. More...
 
static time from_number (double number)
 Returns a time from a number representing a fraction of a day. The integer part of number will be ignored. 0.5 would return time(12, 0, 0, 0) or noon, halfway through the day. More...
 

Public Attributes

int hour = 0
 The hour More...
 
int minute = 0
 The minute More...
 
int second = 0
 The second More...
 
int microsecond = 0
 The microsecond More...
 

Detailed Description

A time is a specific time of the day specified in terms of an hour, minute, second, and microsecond (0-999999). It can also be initialized as a fraction of a day using time::from_number.

Constructor & Destructor Documentation

◆ time() [1/2]

xlnt::time::time ( int  hour_ = 0,
int  minute_ = 0,
int  second_ = 0,
int  microsecond_ = 0 
)
explicit

Constructs a time object from an optional hour, minute, second, and microsecond.

◆ time() [2/2]

xlnt::time::time ( const std::string &  time_string)
explicit

Constructs a time object from a string representing the time.

Member Function Documentation

◆ from_number()

static time xlnt::time::from_number ( double  number)
static

Returns a time from a number representing a fraction of a day. The integer part of number will be ignored. 0.5 would return time(12, 0, 0, 0) or noon, halfway through the day.

◆ now()

static time xlnt::time::now ( )
static

Returns the current time according to the system time.

◆ operator==()

bool xlnt::time::operator== ( const time comparand) const

Returns true if this time is equivalent to comparand.

◆ to_number()

double xlnt::time::to_number ( ) const

Returns a numeric representation of the time in the range 0-1 where the value is equal to the fraction of the day elapsed.

Member Data Documentation

◆ hour

int xlnt::time::hour = 0

The hour

◆ microsecond

int xlnt::time::microsecond = 0

The microsecond

◆ minute

int xlnt::time::minute = 0

The minute

◆ second

int xlnt::time::second = 0

The second


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