dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
timeutils.h
Go to the documentation of this file.
1 
13 /*
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful, but
20  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  * for more details.
23  *
24  * You should have received a copy of the GNU General Public License along
25  * with this program; if not, see <http://www.gnu.org/licenses/>
26  */
27 
28 #ifndef _TIMEUTILS_H
29 #define _TIMEUTILS_H
30 
31 #include <stdint.h>
32 
33 typedef struct {
34  uint8_t sec; // seconds after the minute - [0, 60]
35  uint8_t min; // minutes after the hour - [0, 59]
36  uint8_t hour; // hours since midnight - [0, 23]
37  uint8_t mday; // day of the month - [1, 31]
38  uint8_t mon; // months since January - [0, 11]
39  uint8_t wday; // days since Sunday - [0, 6]
40  uint8_t year; // years since 1900
41 } __attribute__((packed)) DateTimeT;
42 
43 void date_from_timestamp(uint32_t timestamp, DateTimeT *date_time);
44 
45 
46 #endif /* _TIMEUTILS_H */
uint8_t mday
Definition: timeutils.h:37
uint8_t min
Definition: timeutils.h:35
void date_from_timestamp(uint32_t timestamp, DateTimeT *date_time)
Definition: timeutils.c:51
uint8_t wday
Definition: timeutils.h:39
uint8_t mon
Definition: timeutils.h:38
uint8_t hour
Definition: timeutils.h:36
uint8_t year
Definition: timeutils.h:40
uint8_t sec
Definition: timeutils.h:34
typedef __attribute__
Definition: serial_4way.h:43