semf
|
The Time
class provides clock time functions.
More...
#include <time.h>
Public Member Functions | |
Time ()=default | |
Time (const Time &timeToSet) | |
Copy constructor. More... | |
Time (uint16_t millisecond, uint8_t second, uint8_t minute, uint8_t hour) | |
Constructor for static time. More... | |
virtual | ~Time ()=default |
bool | setTime (uint16_t millisecond, uint8_t second, uint8_t minute, uint8_t hour) |
Sets date time information and system clock if Rtc is registered. More... | |
uint16_t | millisecond () const |
Returns the milliseconds from system clock or static value. More... | |
bool | setMillisecond (uint16_t millisecond) |
Sets the milliseconds. More... | |
uint8_t | second () const |
Returns the seconds from system clock or static value. More... | |
bool | setSecond (uint8_t second) |
Sets the seconds. More... | |
uint8_t | minute () const |
Returns the minutes. More... | |
bool | setMinute (uint8_t minute) |
Sets the minutes. More... | |
uint8_t | hour () const |
Returns the hours. More... | |
bool | setHour (uint8_t hour) |
Sets the hours. More... | |
void | addMilliseconds (int32_t milliseconds) |
Adds milliseconds to this time. More... | |
void | addSeconds (int32_t seconds) |
Adds seconds to this time. More... | |
void | addMinutes (int32_t minutes) |
Adds minutes to this time. More... | |
void | addHours (int32_t hours) |
Adds hours to this time. More... | |
uint32_t | secondsSinceStartOfDay () const |
Returns the seconds since start of the day. More... | |
uint32_t | millisecondsSinceStartOfDay () const |
Returns the milliseconds since start of the day. More... | |
int32_t | timeSpan (const Time &subtract) const |
Returns a time difference between this time and subtract . More... | |
Time & | operator= (const Time &timeToSet) |
Copies the time. More... | |
bool | operator== (const Time &timeToCompareWith) const |
Compares this time with other . More... | |
bool | operator!= (const Time &timeToCompareWith) const |
Compares this time with other . More... | |
bool | operator< (const Time &timeToCompareWith) const |
Compares this time with other . More... | |
bool | operator<= (const Time &timeToCompareWith) const |
Compares this time with other . More... | |
bool | operator> (const Time &timeToCompareWith) const |
Compares this time with other . More... | |
bool | operator>= (const Time &timeToCompareWith) const |
Compares this time with other . More... | |
Static Protected Member Functions | |
static bool | isValid (uint16_t millisecond, uint8_t second, uint8_t minute, uint8_t hour) |
Returns if the given time is valid. More... | |
The Time
class provides clock time functions.
A Time
object contains a time expressed as the numbers of hours, minutes, seconds, and milliseconds since midnight. It provides functions for comparing two Time
objects and for altering a Time
object by adding a number of milliseconds.
Time
uses the 24-hour clock format; it has no concept of AM/PM. Unlike DateTime
, Time
knows nothing about time zones or daylight-saving time (DST).
A Time
object is typically created either by giving the number of hours, minutes, seconds, and milliseconds explicitly.
The hours()
, minutes()
, seconds(), and milliseconds() functions provide access to the number of hours, minutes, seconds, and milliseconds of the time.
|
default |
semf::Time::Time | ( | const Time & | timeToSet | ) |
semf::Time::Time | ( | uint16_t | millisecond, |
uint8_t | second, | ||
uint8_t | minute, | ||
uint8_t | hour | ||
) |
|
virtualdefault |
void semf::Time::addHours | ( | int32_t | hours | ) |
void semf::Time::addMilliseconds | ( | int32_t | milliseconds | ) |
void semf::Time::addMinutes | ( | int32_t | minutes | ) |
void semf::Time::addSeconds | ( | int32_t | seconds | ) |
uint8_t semf::Time::hour | ( | ) | const |
|
staticprotected |
Returns if the given time is valid.
millisecond | Millisecond to check. |
second | Second to check. |
minute | Minute to check. |
hour | Hour to check. |
true
for time setting is valid, false
for not. Definition at line 300 of file time.cpp.
uint16_t semf::Time::millisecond | ( | ) | const |
uint32_t semf::Time::millisecondsSinceStartOfDay | ( | ) | const |
uint8_t semf::Time::minute | ( | ) | const |
bool semf::Time::operator!= | ( | const Time & | timeToCompareWith | ) | const |
bool semf::Time::operator< | ( | const Time & | timeToCompareWith | ) | const |
bool semf::Time::operator<= | ( | const Time & | timeToCompareWith | ) | const |
bool semf::Time::operator== | ( | const Time & | timeToCompareWith | ) | const |
bool semf::Time::operator> | ( | const Time & | timeToCompareWith | ) | const |
bool semf::Time::operator>= | ( | const Time & | timeToCompareWith | ) | const |
uint8_t semf::Time::second | ( | ) | const |
uint32_t semf::Time::secondsSinceStartOfDay | ( | ) | const |
bool semf::Time::setHour | ( | uint8_t | hour | ) |
bool semf::Time::setMillisecond | ( | uint16_t | millisecond | ) |
bool semf::Time::setMinute | ( | uint8_t | minute | ) |
bool semf::Time::setSecond | ( | uint8_t | second | ) |
bool semf::Time::setTime | ( | uint16_t | millisecond, |
uint8_t | second, | ||
uint8_t | minute, | ||
uint8_t | hour | ||
) |
Sets date time information and system clock if Rtc
is registered.
millisecond | Milliseconds to set. |
second | Seconds to set. |
minute | Minutes to set. |
hour | Hours to set. |
true
for time is valid, false
for not. Definition at line 25 of file time.cpp.