Loading...
Searching...
No Matches
walltime.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 ML!PA Consulting GmbH
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5#pragma once
6
26
27#include <stdbool.h>
28#include <stdint.h>
29#include <time.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
43typedef void (*walltime_change_cb_t)(void *ctx, int32_t diff_sec, int16_t diff_ms);
44
49typedef struct {
50 void *next;
52 void *ctx;
54
55
65
75
84int walltime_set(struct tm *time);
85
96int walltime_get(struct tm *time, uint16_t *ms);
97
106uint32_t walltime_get_riot(uint16_t *ms);
107
116time_t walltime_get_unix(uint16_t *ms);
117
128uint32_t walltime_uptime(bool full);
129
134
142int walltime_impl_set(struct tm *time);
143
152int walltime_impl_get(struct tm *time, uint16_t *ms);
153
154#ifdef __cplusplus
155}
156#endif
157
bool walltime_change_unsubscribe(walltime_change_sub_t *sub)
Remove a time change notification subscription.
int walltime_impl_get(struct tm *time, uint16_t *ms)
Backend implementation to get the system time.
uint32_t walltime_uptime(bool full)
Get seconds elapsed since last reset.
void walltime_change_subscribe(walltime_change_sub_t *sub)
Add a time change notification subscription This will be called whenever the system time changes.
uint32_t walltime_get_riot(uint16_t *ms)
Get the current system time in seconds since RIOT_EPOCH.
int walltime_impl_set(struct tm *time)
Backend implementation to set the system time.
int walltime_set(struct tm *time)
Set the system date / time.
int walltime_get(struct tm *time, uint16_t *ms)
Get the system date / time.
void(* walltime_change_cb_t)(void *ctx, int32_t diff_sec, int16_t diff_ms)
Time change notification callback.
Definition walltime.h:43
time_t walltime_get_unix(uint16_t *ms)
Get the current system time in seconds since 01.01.1970.
void walltime_impl_init(void)
Backend implementation init, only implement when necessary.
Time change notification subscription.
Definition walltime.h:49
void * next
next pointer, internal use only
Definition walltime.h:50
void * ctx
callback function context
Definition walltime.h:52
walltime_change_cb_t cb
time change callback function
Definition walltime.h:51