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 
9 #pragma once
10 
21 #include <stdbool.h>
22 #include <stdint.h>
23 #include <time.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
42 void rtc_tm_normalize(struct tm *time);
43 
58 int rtc_tm_compare(const struct tm *a, const struct tm *b);
59 
71 uint32_t rtc_mktime(const struct tm *t);
72 
79 void rtc_localtime(uint32_t time, struct tm *t);
80 
92 bool rtc_tm_valid(const struct tm *t);
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
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.