A class for time manipulation.
More...
#include <edelib/DateTime.h>
|
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.
- Note
- Time where hour is 0 is always less than time where hour is 23.
- Todo:
- Time is missing local/UTC option.
◆ Time() [1/2]
Constructor that will set all time members to 0. This is valid time.
◆ Time() [2/2]
Construct time via previously declared value
◆ ~Time()
◆ hour()
unsigned char hour |
( |
void |
| ) |
const |
|
inline |
◆ is_valid()
static bool is_valid |
( |
unsigned char |
h, |
|
|
unsigned char |
m, |
|
|
unsigned char |
s |
|
) |
| |
|
static |
Check if given parameters can be valid time
- Returns
- true if time is valid
- Parameters
-
h | is hour |
m | is minutes |
s | is seconds |
◆ minute()
unsigned char minute |
( |
void |
| ) |
const |
|
inline |
◆ operator++() [1/2]
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).
◆ operator++() [2/2]
◆ operator--() [1/2]
◆ operator--() [2/2]
◆ operator=()
Assign previously declared value. Current time will be replaced.
◆ second()
unsigned char second |
( |
void |
| ) |
const |
|
inline |
◆ set()
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.
- Parameters
-
h | is hour |
m | is minutes |
s | is seconds |
◆ set_now()
Read system time and fill internal values
- Todo:
- This should be probably a static function
◆ system_set()
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).
- Todo:
- This should be probably a static function
The documentation for this class was generated from the following file: