Filter results by

Older Versions

Older API versions are available as a download. To view, extract the file and open the index.html file in a web browser.

artik_time_module Struct Reference

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]date1First date to compare
[in]date2Second 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]dateThe date to convert from
[out]timestampResult 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]timestampThe timestamp to convert from
[out]dateResult 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]gmtLocal time zone in GMT format.
[in]valueDate at which the alarm must be triggered
[out]handleHandle referencing the alarm for later use.
[in]funcThe callback function which will be called when the alarm is triggered (mandatory).
[in]user_dataThe 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]gmtLocal time zone in GMT format.
[in]valueNumber of seconds to elapse before the alarm is triggered
[out]handleHandle referencing the alarm for later use.
[in]funcThe callback function which will be called when the alarm is triggered (mandatory).
[in]user_dataThe 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]handleHandle 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]handleHandle of the alarm to delete.
[out]msecondNumber 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]gmtGMT is the target of local time.
[out]dateDate 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_strPreallocated string to be filled up with the date.
[in]sizeSize of the preallocated date string
[in]formatFormat string to use for generating the date string.
[in]gmtLocal 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]dateDate is the time to set for the system clock.
[in]gmtThe 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]hostnameHostname 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:
Last updated on: