#include <datetime.h>
Public Types | |
enum | index_t { hour = 20, minute, second } |
Component access index. | |
Public Member Functions | |
char * | get (char *buffer) |
Get a hh:mm:ss formatted string for current time. | |
long | get (void) |
Get current time in seconds from midnight. | |
int | getHour (void) |
Get hours from midnight. | |
int | getMinute (void) |
Get minutes from current hour. | |
int | getSecond (void) |
Get seconds from current minute. | |
bool | isValid (void) |
Check if time object had valid value. | |
operator bool () | |
Check if time object has valid value for is() operator. | |
operator long () | |
Get time in seconds. | |
bool | operator! () |
Check if time object has valid value for ! operator. | |
bool | operator!= (Time &time) |
Compare time with another time to see if not same time. | |
String | operator() () |
Convert to standard 24 hour time string. | |
long | operator* () |
Get object time in seconds. | |
Time | operator+ (long seconds) |
Add seconds to the current time, wrap if 24 hours. | |
Time & | operator++ () |
Incrememnt time by 1 second, wrap on 24 hour period. | |
Time & | operator+= (long seconds) |
Increment time by specified seconds. | |
Time | operator- (long seconds) |
Subtract seconds to the current time, wrap if 24 hours. | |
long | operator- (Time &reference) |
Get difference (in seconds) between two times. | |
Time & | operator-- () |
Decrement time by 1 second, wrap on 24 hour period. | |
Time & | operator-= (long seconds) |
Decrement time by specified seconds. | |
bool | operator< (Time &time) |
Compare time if earlier than another time. | |
bool | operator<= (Time &time) |
Compare time if earlier than or equal to another time. | |
Time & | operator= (Time &time) |
Assign a time as a copy of another time. | |
bool | operator== (Time &time) |
Compare time with another time to see if same time. | |
bool | operator> (Time &time) |
Compare time if later than another time. | |
bool | operator>= (Time &time) |
Compare time if later than or equal to another time. | |
int | operator[] (index_t component) |
Get component of time object. | |
void | set (char *pointer, size_t size=0) |
Set time from a hh:mm:ss formatted string. | |
void | set (void) |
Set (update) the time with current time. | |
Time () | |
Create a time from current time. | |
Time (Time &object) | |
Create a time object from another object. | |
Time (int hour, int minute, int second) | |
Create a time from hours (0-23), minutes (0-59), and seconds (0-59). | |
Time (char *pointer, size_t size=0) | |
Create a time from a hh:mm:ss formatted time string. | |
Time (tm_t *object) | |
Create a time from the time portion of a date and time object. | |
Time (time_t value) | |
Create a time from the time portion of a time_t. | |
virtual | ~Time () |
Destroy time object. | |
Static Public Attributes | |
static size_t | sz_string |
Size of time string field. | |
Protected Member Functions | |
void | fromSeconds (char *buf) |
void | toSeconds (int hour, int minute=0, int second=0) |
virtual void | update (void) |
Protected Attributes | |
long | seconds |
This is then manipulated in several forms and may be exported as needed. The time object can represent an instance in time (hours, minutes, and seconds) in a 24 hour period or can represent a duration. Millisecond accuracy can be offered.
Definition at line 360 of file datetime.h.
ucc::Time::Time | ( | time_t | value | ) |
Create a time from the time portion of a time_t.
value | of time_t to use. |
ucc::Time::Time | ( | tm_t * | object | ) |
Create a time from the time portion of a date and time object.
object | from DateTime::glt() or gmt(). |
ucc::Time::Time | ( | char * | pointer, | |
size_t | size = 0 | |||
) |
ucc::Time::Time | ( | int | hour, | |
int | minute, | |||
int | second | |||
) |
Create a time from hours (0-23), minutes (0-59), and seconds (0-59).
hour | of time. | |
minute | of time. | |
second | of time. |
ucc::Time::Time | ( | Time & | object | ) |
Create a time object from another object.
object | to copy. |
char* ucc::Time::get | ( | char * | buffer | ) |
Get a hh:mm:ss formatted string for current time.
buffer | to store time string in. |
Reimplemented in ucc::DateTime.
long ucc::Time::get | ( | void | ) |
Get current time in seconds from midnight.
Reimplemented in ucc::DateTime.
int ucc::Time::getHour | ( | void | ) |
Get hours from midnight.
int ucc::Time::getMinute | ( | void | ) |
Get minutes from current hour.
int ucc::Time::getSecond | ( | void | ) |
Get seconds from current minute.
bool ucc::Time::isValid | ( | void | ) |
Check if time object had valid value.
Reimplemented in ucc::DateTime.
ucc::Time::operator bool | ( | ) | [inline] |
Check if time object has valid value for is() operator.
Reimplemented in ucc::DateTime.
Definition at line 477 of file datetime.h.
ucc::Time::operator long | ( | ) | [inline] |
Get time in seconds.
Reimplemented in ucc::DateTime.
Definition at line 512 of file datetime.h.
bool ucc::Time::operator! | ( | ) | [inline] |
Check if time object has valid value for ! operator.
Reimplemented in ucc::DateTime.
Definition at line 484 of file datetime.h.
bool ucc::Time::operator!= | ( | Time & | time | ) |
Compare time with another time to see if not same time.
time | to compare with. |
long ucc::Time::operator* | ( | ) | [inline] |
Time ucc::Time::operator+ | ( | long | seconds | ) |
Add seconds to the current time, wrap if 24 hours.
seconds | to add. |
Reimplemented in ucc::DateTime.
Time& ucc::Time::operator++ | ( | ) |
Incrememnt time by 1 second, wrap on 24 hour period.
Reimplemented in ucc::DateTime.
Time& ucc::Time::operator+= | ( | long | seconds | ) |
Increment time by specified seconds.
Wraps on 24 hour period.
seconds | to add to current time. |
Reimplemented in ucc::DateTime.
Time ucc::Time::operator- | ( | long | seconds | ) |
Subtract seconds to the current time, wrap if 24 hours.
seconds | to subtract. |
Reimplemented in ucc::DateTime.
long ucc::Time::operator- | ( | Time & | reference | ) |
Get difference (in seconds) between two times.
reference | time to get difference from. |
Time& ucc::Time::operator-- | ( | ) |
Decrement time by 1 second, wrap on 24 hour period.
Reimplemented in ucc::DateTime.
Time& ucc::Time::operator-= | ( | long | seconds | ) |
Decrement time by specified seconds.
Wraps on 24 hour period.
seconds | to subtract from current time. |
Reimplemented in ucc::DateTime.
bool ucc::Time::operator< | ( | Time & | time | ) |
Compare time if earlier than another time.
time | object to compare with. |
bool ucc::Time::operator<= | ( | Time & | time | ) |
Compare time if earlier than or equal to another time.
time | object to compare with. |
Assign a time as a copy of another time.
time | to assign from. |
bool ucc::Time::operator== | ( | Time & | time | ) |
Compare time with another time to see if same time.
time | to compare with. |
bool ucc::Time::operator> | ( | Time & | time | ) |
Compare time if later than another time.
time | object to compare with. |
bool ucc::Time::operator>= | ( | Time & | time | ) |
Compare time if later than or equal to another time.
time | object to compare with. |
int ucc::Time::operator[] | ( | index_t | component | ) |
Get component of time object.
component | index. |
void ucc::Time::set | ( | char * | pointer, | |
size_t | size = 0 | |||
) |