Time module operations. More...
#include <base/artik_time.h>
Data Fields | |
| artik_error(* | set_time )(artik_time date, artik_time_zone gmt) |
| Set Time with the Time API. More... | |
| artik_error(* | get_time )(artik_time_zone gmt, artik_time *date) |
| Get Time with the Time API. More... | |
| artik_error(* | get_time_str )(char *date_str, int size, char *const format, artik_time_zone gmt) |
| Get Time String with the Time API. More... | |
| artik_msecond(* | get_tick )(void) |
| Get system tick. More... | |
| artik_error(* | create_alarm_second )(artik_time_zone gmt, artik_msecond value, artik_alarm_handle *handle, alarm_callback func, void *user_data) |
| Create an alarm to set off after an amount of time elapsed from now. More... | |
| artik_error(* | create_alarm_date )(artik_time_zone gmt, artik_time value, artik_alarm_handle *handle, alarm_callback func, void *user_data) |
| Create an alarm to set off at a specific date. More... | |
| artik_error(* | delete_alarm )(artik_alarm_handle handle) |
| Wait for an alarm to set off. This function is blocking until the alarm is triggered. More... | |
| artik_error(* | get_delay_alarm )(artik_alarm_handle handle, artik_msecond *msecond) |
| Get the amount of remaining seconds before an alarm is triggered. More... | |
| artik_error(* | sync_ntp )(const char *hostname) |
| Synchronize system date with remote NTP server. More... | |
| int(* | compare_dates )(const artik_time *date1, const artik_time *date2) |
| Compare two dates. More... | |
| artik_error(* | convert_timestamp_to_time )(const int64_t timestamp, artik_time *date) |
| Convert UNIX timestamp (seconds elapsed since Jan 01 1970 UTC) into time. More... | |
| artik_error(* | convert_time_to_timestamp )(const artik_time *date, int64_t *timestamp) |
| Convert time into UNIX timestamp (seconds elapsed since Jan 01 1970 UTC). More... | |
Detailed Description
Structure containing all the exposed operations exposed by the module to operate on with the Time API
- Examples:
- time_test/artik_time_test.c.
Definition at line 156 of file artik_time.h.
Field Documentation
| int(* artik_time_module::compare_dates) (const artik_time *date1, const artik_time *date2) |
- Parameters
-
[in] date1 First date to compare [in] date2 Second date to compare
- Returns
- 0 if dates are equal -1 if date1 occurs before date2 1 if date1 occurs after date2 -2 if the parameters are invalid
Definition at line 282 of file artik_time.h.
| artik_error(* artik_time_module::convert_time_to_timestamp) (const artik_time *date, int64_t *timestamp) |
- Parameters
-
[in] date The date to convert from [out] timestamp Result of the conversion into timestamp.
- Returns
- S_OK on success, error code otherwise
- Examples:
- time_test/artik_time_test.c.
Definition at line 305 of file artik_time.h.
| artik_error(* artik_time_module::convert_timestamp_to_time) (const int64_t timestamp, artik_time *date) |
- Parameters
-
[in] timestamp The timestamp to convert from [out] date Result of the conversion into date.
- Returns
- S_OK on success, error code otherwise
- Examples:
- time_test/artik_time_test.c.
Definition at line 292 of file artik_time.h.
| artik_error(* artik_time_module::create_alarm_date) (artik_time_zone gmt, artik_time value, artik_alarm_handle *handle, alarm_callback func, void *user_data) |
- Parameters
-
[in] gmt Local time zone in GMT format. [in] value Date at which the alarm must be triggered [out] handle Handle referencing the alarm for later use. [in] func The callback function which will be called when the alarm is triggered (mandatory). [in] user_data The user data passed from the register callback function.
- Returns
- S_OK on success, error code otherwise
- Examples:
- time_test/artik_time_test.c.
Definition at line 236 of file artik_time.h.
| artik_error(* artik_time_module::create_alarm_second) (artik_time_zone gmt, artik_msecond value, artik_alarm_handle *handle, alarm_callback func, void *user_data) |
- Parameters
-
[in] gmt Local time zone in GMT format. [in] value Number of seconds to elapse before the alarm is triggered [out] handle Handle referencing the alarm for later use. [in] func The callback function which will be called when the alarm is triggered (mandatory). [in] user_data The user data passed from the register callback function.
- Returns
- S_OK on success, error code otherwise
- Examples:
- time_test/artik_time_test.c.
Definition at line 217 of file artik_time.h.
| artik_error(* artik_time_module::delete_alarm) (artik_alarm_handle handle) |
- Parameters
-
[in] handle Handle of the alarm to wait for.
- Returns
- S_OK on success, error code otherwise
- Examples:
- time_test/artik_time_test.c.
Definition at line 250 of file artik_time.h.
| artik_error(* artik_time_module::get_delay_alarm) (artik_alarm_handle handle, artik_msecond *msecond) |
- Parameters
-
[in] handle Handle of the alarm to delete. [out] msecond Number of seconds from now after which the alarm is triggered.
- Returns
- S_OK on success, error code otherwise
- Examples:
- time_test/artik_time_test.c.
Definition at line 261 of file artik_time.h.
| artik_msecond(* artik_time_module::get_tick) (void) |
- Returns
- Number of milliseconds corresponding to the system tick
- Examples:
- time_test/artik_time_test.c.
Definition at line 200 of file artik_time.h.
| artik_error(* artik_time_module::get_time) (artik_time_zone gmt, artik_time *date) |
- Parameters
-
[in] gmt GMT is the target of local time. [out] date Date is the time to get for the system clock.
- Returns
- S_OK on success, error code otherwise
- Examples:
- time_test/artik_time_test.c.
Definition at line 176 of file artik_time.h.
| artik_error(* artik_time_module::get_time_str) (char *date_str, int size, char *const format, artik_time_zone gmt) |
- Parameters
-
[out] date_str Preallocated string to be filled up with the date. [in] size Size of the preallocated date string [in] format Format string to use for generating the date string. [in] gmt Local time zone in GMT format.
- Returns
- S_OK on success, E_BAD_ARGS if 'date_str' and/or 'size' and/or 'format' is/are not well defined, error code otherwise
- Examples:
- time_test/artik_time_test.c.
Definition at line 192 of file artik_time.h.
| artik_error(* artik_time_module::set_time) (artik_time date, artik_time_zone gmt) |
- Parameters
-
[in] date Date is the time to set for the system clock. [in] gmt The time-zone of the variable date
- Returns
- S_OK on success, error code otherwise
- Examples:
- time_test/artik_time_test.c.
Definition at line 166 of file artik_time.h.
| artik_error(* artik_time_module::sync_ntp) (const char *hostname) |
- Parameters
-
[in] hostname Hostname of NTP server.
- Returns
- S_OK on success, error code otherwise
- Examples:
- time_test/artik_time_test.c.
Definition at line 270 of file artik_time.h.
The documentation for this struct was generated from the following file:
- inc/base/artik_time.h