An interface to system calendar time provided by the OS. The implementation and the capabilities of the OSCalTime depend on the OS used.
|
OSCalTime | OSCALTIME_Get (void) |
|
HALRESULT | OSCALTIME_Set (OSCalTime time) |
|
HALRESULT | OSCALTIME_Adjust (OSCalTime timeadj) |
|
HALRESULT | OSCALTIME_ToDateTime (OSCalTime time, uint16_t *year, uint8_t *month, uint8_t *day, uint8_t *hours, uint8_t *minutes, uint8_t *seconds, uint32_t *nanoseconds) |
|
HALRESULT | OSCALTIME_FromDateTime (uint16_t year, uint8_t month, uint8_t day, uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t nanoseconds, OSCalTime *time) |
|
int64_t | OSCALTIME_ToNS (OSCalTime time) |
|
OSCalTime | OSCALTIME_FromNS (int64_t ns) |
|
HALRESULT | OSCALTIME_ToString (OSCalTime time, char *str) |
|
OSCalTime OSCALTIME_Get |
( |
void |
| ) |
|
Gets the current system calendar time.
- Returns
- current calendar time.
Sets the current calendar time.
- Parameters
-
- Returns
- HALRESULT_OK on success. Other values indicate error.
HALRESULT OSCALTIME_Adjust |
( |
OSCalTime |
timeadj | ) |
|
Adjusts the current calendar time by a given time amount.
- Parameters
-
- Returns
- HALRESULT_OK on success. Other values indicate error.
HALRESULT OSCALTIME_ToDateTime |
( |
OSCalTime |
time, |
|
|
uint16_t * |
year, |
|
|
uint8_t * |
month, |
|
|
uint8_t * |
day, |
|
|
uint8_t * |
hours, |
|
|
uint8_t * |
minutes, |
|
|
uint8_t * |
seconds, |
|
|
uint32_t * |
nanoseconds |
|
) |
| |
Converts the given calendar time to human readable form.
- Parameters
-
time | calendar time to convert |
year | place to store year |
month | place to store month |
month | place to store month |
day | place to store day |
hours | place to store hours |
minutes | place to store minutes |
seconds | place to store seconds |
nanoseconds | place to store nanoseconds |
- Returns
- HALRESULT_OK on success. Other values indicate error.
HALRESULT OSCALTIME_FromDateTime |
( |
uint16_t |
year, |
|
|
uint8_t |
month, |
|
|
uint8_t |
day, |
|
|
uint8_t |
hours, |
|
|
uint8_t |
minutes, |
|
|
uint8_t |
seconds, |
|
|
uint32_t |
nanoseconds, |
|
|
OSCalTime * |
time |
|
) |
| |
Converts the given time into OS calendar time.
- Parameters
-
year | year (in example 2013) |
month | month number (1 - January, 12 - December) |
day | day (1..31) |
hours | hour (0..23) |
minutes | minutes (0..59) |
seconds | seconds (0..59) |
nanoseconds | nanoseconds (0..999999999) |
time | place to store calendar time |
- Returns
- HALRESULT_OK on success. Other values indicate error.
int64_t OSCALTIME_ToNS |
( |
OSCalTime |
time | ) |
|
Converts the given calendar time into a number of nanoseconds since Jan 1st 1970.
- Parameters
-
- Returns
- number of nanoseconds since Jan 1st 1970
OSCalTime OSCALTIME_FromNS |
( |
int64_t |
ns | ) |
|
Converts the given number of nanoseconds since Jan 1st 1970 into a calendar time.
- Parameters
-
ns | number of nanoseconds since Jan 1st 1970 |
- Returns
- calendar time
HALRESULT OSCALTIME_ToString |
( |
OSCalTime |
time, |
|
|
char * |
str |
|
) |
| |
Converts the given calendar time into a string representation of "YYYY-MM-DD hh:mm:ss.nanosecond"
- Parameters
-
time | calendar time |
str | place to store the string (must be at least 32 characters long) |
- Returns
- HALRESULT_OK on success. Other values indicate error.