ADTF  3.18.3
Time

Time implementation representing a time of day (00:00:00,0 - 23:59:59,999999) More...

Inheritance diagram for Time:
[legend]

Public Member Functions

 Time ()
 Default constructor - initializes the time to 00:00:00,0.
 
 Time (int hour, int minute, int second, int microsecond=0)
 Constructor for presetting the stored time. More...
 
void set (int hour, int minute, int second, int microsecond=0)
 Sets the stored time. More...
 
bool set (const std::string &time)
 Sets the time a given time string. More...
 
void setHour (int hour)
 Set the hour. More...
 
int getHour () const
 Get the hour. More...
 
void setMinute (int minute)
 Set the minute. More...
 
int getMinute () const
 Get the minute. More...
 
void setSecond (int second)
 Set the second. More...
 
int getSecond () const
 Get the second. More...
 
void setMicrosecond (int microsecond)
 Set the microsecond. More...
 
int getMicrosecond () const
 Get the microsecond. More...
 
std::string format (const std::string &format_str) const
 Creates a string representation of the stored time. More...
 

Private Attributes

int _hour
 
int _minute
 
int _second
 
int _microsecond
 

Detailed Description

Time implementation representing a time of day (00:00:00,0 - 23:59:59,999999)

Warning
: This class does not enforce time consistency!

Definition at line 152 of file workspace/conan/dev_essential/1.3.4/dw/stable/package/aef85909f792a5a628750d25016a24323084963f/include/a_util/datetime/datetime.h.

Constructor & Destructor Documentation

◆ Time()

Time ( int  hour,
int  minute,
int  second,
int  microsecond = 0 
)

Constructor for presetting the stored time.

Parameters
[in]hourThe hour.
[in]minuteThe minute.
[in]secondThe second.
[in]microsecondThe microsecond.

Member Function Documentation

◆ format()

std::string format ( const std::string &  format_str) const

Creates a string representation of the stored time.

Parameters
[in]format_strThe format of the string representation (see DateTime::format, might be empty).
Returns
A string representation of the stored date.
Exceptions
std::invalid_argumentIf the format string is invalid

◆ getHour()

int getHour ( ) const

Get the hour.

Returns
The hour.

◆ getMicrosecond()

int getMicrosecond ( ) const

Get the microsecond.

Returns
[in] The microsecond.

◆ getMinute()

int getMinute ( ) const

Get the minute.

Returns
The minute.

◆ getSecond()

int getSecond ( ) const

Get the second.

Returns
The second.

◆ set() [1/2]

bool set ( const std::string &  time)

Sets the time a given time string.

This string formats are supported: HH:MM:SS

  • HH Hour in 24-hour format (zero-padded 00..23)
  • MM Minute as decimal number (zero-padded 00..59)
  • SS Second as decimal number (zero-padded 00..59)
  • : Separator for hour:minute:second
Parameters
[in]timeThe string contains the given time as string.
Returns
false if the time string format is invalid, true otherwise

◆ set() [2/2]

void set ( int  hour,
int  minute,
int  second,
int  microsecond = 0 
)

Sets the stored time.

Parameters
[in]hourThe hour.
[in]minuteThe minute.
[in]secondThe second.
[in]microsecondThe microsecond.

◆ setHour()

void setHour ( int  hour)

Set the hour.

Parameters
[in]hourThe hour.

◆ setMicrosecond()

void setMicrosecond ( int  microsecond)

Set the microsecond.

Parameters
[in]microsecondThe microsecond.

◆ setMinute()

void setMinute ( int  minute)

Set the minute.

Parameters
[in]minuteThe minute.

◆ setSecond()

void setSecond ( int  second)

Set the second.

Parameters
[in]secondThe second.