Retrieve current time in different formats and sleep.
More...
Retrieve current time in different formats and sleep.
int ua_time_build_datetime |
( |
uint64_t * |
dt | ) |
|
Returns the build time as UA datatime.
int ua_time_datetime |
( |
uint64_t * |
dt | ) |
|
Returns the current time in ua_datetime format.
For more type safety use ua_datetime_now.
- Parameters
-
dt | Pointer to uint64 to write time to. |
- Returns
- Zero on success or errorcode on failure.
void ua_time_filetime_to_unixtime |
( |
const uint64_t * |
ft, |
|
|
struct ua_timestamp * |
ts |
|
) |
| |
Converts Unix time to Windows FILETIME.
- Parameters
-
ft | Pointer to uint64_t with Windows FILETIME. |
ts | Pointer to ua_timestamp with Unix time. |
int ua_time_set_datetime |
( |
uint64_t |
dt | ) |
|
Sets the system time as ua_datetime (FILETIME).
This is a convenience wrapper for ua_time_set_time which uses ua_datetime instead of unix time. This can be useful when the time source is an OPC UA variant value.
- Parameters
-
- Returns
- Zero on success or errorcode on failure.
Sets the system time as ua_timestamp format (unix time).
Note that you need the necessary admin permissions on most systems to use this function. This function is mainly useful for small embedded systems which have no built-in time synchronization like NTP. On full-featured operating systems like Linux/Unix and Windows the operating systems takes care about time synchronization and you should not interfere with that.
- Parameters
-
- Returns
- Zero on success or a negative error code with the operation fails.
Returns the current time in ua_timestamp format.
- Parameters
-
- Returns
- Zero on success or a negative error code with the operation fails.
void ua_time_unixtime_to_filetime |
( |
const struct ua_timestamp * |
ts, |
|
|
uint64_t * |
ft |
|
) |
| |
Converts Unix time to Windows FILETIME.
- Parameters
-
ts | Pointer to ua_timestamp with Unix time. |
ft | Pointer to uint64_t with Windows FILETIME. |
void ua_time_usleep |
( |
unsigned int |
usec | ) |
|
Suspend execution of the calling thread (at least) usec
microseconds.