rtc_utils.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 ML!PA Consulting GmbH
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
19 #ifndef RTC_UTILS_H
20 #define RTC_UTILS_H
21 
22 #include <stdbool.h>
23 #include <stdint.h>
24 #include <time.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
43 void rtc_tm_normalize(struct tm *time);
44 
59 int rtc_tm_compare(const struct tm *a, const struct tm *b);
60 
72 uint32_t rtc_mktime(const struct tm *t);
73 
80 void rtc_localtime(uint32_t time, struct tm *t);
81 
93 bool rtc_tm_valid(const struct tm *t);
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 #endif /* RTC_UTILS_H */
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.