nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
date_time.h File Reference
#include <zephyr/types.h>
#include <stdbool.h>
#include <time.h>

Go to the source code of this file.

Data Structures

struct  date_time_evt
 Struct with data received from the Date time library. More...
 

Typedefs

typedef void(* date_time_evt_handler_t) (const struct date_time_evt *evt)
 Date time library asynchronous event handler.
 

Enumerations

enum  date_time_evt_type { DATE_TIME_OBTAINED_MODEM , DATE_TIME_OBTAINED_NTP , DATE_TIME_OBTAINED_EXT , DATE_TIME_NOT_OBTAINED }
 Date time notification event types used to signal the application. More...
 

Functions

int date_time_set (const struct tm *new_date_time)
 Set the current date time.
 
int date_time_uptime_to_unix_time_ms (int64_t *uptime)
 Get the date time UTC when the passing variable uptime was set. This function requires that k_uptime_get() has been called on the passing variable uptime prior to the function call. In that case the uptime will not be too large or negative.
 
int date_time_now (int64_t *unix_time_ms)
 Get the current date time UTC.
 
int date_time_now_local (int64_t *local_time_ms)
 Get the current date time in local time.
 
bool date_time_is_valid (void)
 Convenience function that checks if the library has obtained an initial valid date time.
 
bool date_time_is_valid_local (void)
 Check if the library has obtained an initial valid date time and timezone.
 
void date_time_register_handler (date_time_evt_handler_t evt_handler)
 Register an event handler for Date time library events.
 
int date_time_update_async (date_time_evt_handler_t evt_handler)
 Asynchronous update of internal date time UTC. This function initiates a date time update regardless of the internal update interval. If an event handler is provided it will be updated with library events, accordingly.
 
void date_time_clear (void)
 Clear the current date time held by the library.
 
int date_time_timestamp_clear (int64_t *unix_timestamp)
 Clear a timestamp in UNIX time ms.