nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
date_time.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef DATE_TIME_H__
8#define DATE_TIME_H__
9
10#include <zephyr/types.h>
11#include <stdbool.h>
12#include <time.h>
13
21#ifdef __cplusplus
22extern "C" {
23#endif
24
35};
36
41};
42
47typedef void (*date_time_evt_handler_t)(const struct date_time_evt *evt);
48
61int date_time_set(const struct tm *new_date_time);
62
79
92int date_time_now(int64_t *unix_time_ms);
93
107int date_time_now_local(int64_t *local_time_ms);
108
121
132
143
157
161
169int date_time_timestamp_clear(int64_t *unix_timestamp);
170
171#ifdef __cplusplus
172}
173#endif
174
177#endif /* DATE_TIME_H__ */
bool date_time_is_valid(void)
Convenience function that checks if the library has obtained an initial valid date time.
date_time_evt_type
Date time notification event types used to signal the application.
Definition: date_time.h:26
@ DATE_TIME_OBTAINED_NTP
Definition: date_time.h:30
@ DATE_TIME_OBTAINED_MODEM
Definition: date_time.h:28
@ DATE_TIME_NOT_OBTAINED
Definition: date_time.h:34
@ DATE_TIME_OBTAINED_EXT
Definition: date_time.h:32
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_...
int date_time_now_local(int64_t *local_time_ms)
Get the current date time in local time.
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 ...
int date_time_set(const struct tm *new_date_time)
Set the current date time.
int date_time_timestamp_clear(int64_t *unix_timestamp)
Clear a timestamp in UNIX time ms.
void(* date_time_evt_handler_t)(const struct date_time_evt *evt)
Date time library asynchronous event handler.
Definition: date_time.h:47
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.
void date_time_clear(void)
Clear the current date time held by the library.
int date_time_now(int64_t *unix_time_ms)
Get the current date time UTC.
enum date_time_evt_type type
Definition: date_time.h:40
Struct with data received from the Date time library.
Definition: date_time.h:38