edelib
2.0.0
|
A class for time manipulation. More...
#include <edelib/DateTime.h>
Public Member Functions | |
Time () | |
Time (const Time &t) | |
Time & | operator= (const Time &t) |
~Time () | |
void | set (unsigned char h, unsigned char m, unsigned char s=0) |
void | set_now (void) |
bool | system_set (void) |
unsigned char | hour (void) const |
unsigned char | minute (void) const |
unsigned char | second (void) const |
Time & | operator++ () |
Time | operator++ (int) |
Time & | operator-- () |
Time | operator-- (int) |
Static Public Member Functions | |
static bool | is_valid (unsigned char h, unsigned char m, unsigned char s) |
A class for time manipulation.
This class allows you to manipulate with time, fetch or set one. Hour can be 0 <= hour < 24. Minutes and seconds are in 0 <= val < 60.
Time | ( | ) |
Constructor that will set all time members to 0. This is valid time.
~Time | ( | ) |
Destructor
unsigned char hour | ( | void | ) | const [inline] |
Returns hour
static bool is_valid | ( | unsigned char | h, |
unsigned char | m, | ||
unsigned char | s | ||
) | [static] |
Check if given parameters can be valid time
h | is hour |
m | is minutes |
s | is seconds |
unsigned char minute | ( | void | ) | const [inline] |
Returns minutes
Time& operator++ | ( | ) |
Increase current time by one. First seconds are increased; when they reach 59, minutes are increased and seconds are set to 0. The same applies for minutes/hour case. When hour reach for 23, it is set to 0 (the same behaviour as you see from your digital clock).
Time operator++ | ( | int | ) |
Suffix increment
Time& operator-- | ( | ) |
Reverse from operator++()
Time operator-- | ( | int | ) |
Suffix decrement
unsigned char second | ( | void | ) | const [inline] |
Returns seconds
void set | ( | unsigned char | h, |
unsigned char | m, | ||
unsigned char | s = 0 |
||
) |
Set time values. Values should be valid time, or assertion will be triggered.
h | is hour |
m | is minutes |
s | is seconds |
void set_now | ( | void | ) |
Read system time and fill internal values
bool system_set | ( | void | ) |
Tries to set system time with current values. This function requires priviledged user. It behaves the same as Date::system_set() (see it's documentation for detail description).