rtc_utils.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2019 ML!PA Consulting GmbH
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
18 #include <stdbool.h>
19 #include <stdint.h>
20 #include <time.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
39 void rtc_tm_normalize(struct tm *time);
40 
55 int rtc_tm_compare(const struct tm *a, const struct tm *b);
56 
68 uint32_t rtc_mktime(const struct tm *t);
69 
76 void rtc_localtime(uint32_t time, struct tm *t);
77 
89 bool rtc_tm_valid(const struct tm *t);
90 
91 #ifdef __cplusplus
92 }
93 #endif
94 
void rtc_tm_normalize(struct tm *time)
Normalize the time struct.
uint32_t rtc_mktime(const struct tm *t)
Convert time struct into timestamp.
bool rtc_tm_valid(const struct tm *t)
Verify that a time struct t contains valid data.
int rtc_tm_compare(const struct tm *a, const struct tm *b)
Compare two time structs.
void rtc_localtime(uint32_t time, struct tm *t)
Converts an RTC timestamp into a time struct.