cryptnox-pos
1.0.0
Standalone USDC payment terminal firmware (ESP32 + Cryptnox smart card)
Toggle main menu visibility
Loading...
Searching...
No Matches
civil_time.h
Go to the documentation of this file.
1
/*
2
* SPDX-License-Identifier: LGPL-3.0-or-later
3
* Copyright (c) 2026 Cryptnox SA
4
*/
5
18
19
#ifndef CIVIL_TIME_H
20
#define CIVIL_TIME_H
21
22
/******************************************************************
23
* 1. Included files
24
******************************************************************/
25
26
#include <stdint.h>
27
#include <stdbool.h>
28
29
#ifdef __cplusplus
30
extern
"C"
{
31
#endif
32
33
/******************************************************************
34
* 2. Public API
35
******************************************************************/
36
52
int64_t
civil_to_epoch
(
int
year,
int
mon,
int
day,
int
hour,
int
min,
int
sec);
53
61
int
civil_month_from_abbrev
(
const
char
*mmm);
62
74
bool
civil_parse_build_stamp
(
const
char
*date,
const
char
*time_str,
75
int64_t *out);
76
89
bool
civil_parse_http_date
(
const
char
*hdr, int64_t *out);
90
99
typedef
enum
{
100
CIVIL_DST_NONE
= 0,
101
CIVIL_DST_EU
= 1,
102
CIVIL_DST_US
= 2,
103
CIVIL_DST_AU
= 3,
104
CIVIL_DST_NZ
= 4,
105
CIVIL_DST__COUNT
106
}
civil_dst_t
;
107
116
int
civil_local_offset_min
(int64_t utc,
int
std_off_min,
int
rule);
117
118
#ifdef __cplusplus
119
}
120
#endif
121
122
#endif
// CIVIL_TIME_H
civil_parse_http_date
bool civil_parse_http_date(const char *hdr, int64_t *out)
Parse an HTTP-date in IMF-fixdate form into an epoch value.
Definition
civil_time.cpp:138
civil_month_from_abbrev
int civil_month_from_abbrev(const char *mmm)
Map a three-letter English month abbreviation to 1–12.
Definition
civil_time.cpp:88
civil_parse_build_stamp
bool civil_parse_build_stamp(const char *date, const char *time_str, int64_t *out)
Parse the compiler's DATE / TIME pair into an epoch value.
Definition
civil_time.cpp:105
civil_to_epoch
int64_t civil_to_epoch(int year, int mon, int day, int hour, int min, int sec)
Convert a UTC civil date/time to seconds since the Unix epoch.
Definition
civil_time.cpp:80
civil_dst_t
civil_dst_t
Daylight-saving rules the panel clock knows, persisted in NVS as a number, so never renumber them.
Definition
civil_time.h:99
CIVIL_DST_NZ
@ CIVIL_DST_NZ
Definition
civil_time.h:104
CIVIL_DST_US
@ CIVIL_DST_US
Definition
civil_time.h:102
CIVIL_DST_EU
@ CIVIL_DST_EU
Definition
civil_time.h:101
CIVIL_DST__COUNT
@ CIVIL_DST__COUNT
Definition
civil_time.h:105
CIVIL_DST_NONE
@ CIVIL_DST_NONE
Definition
civil_time.h:100
CIVIL_DST_AU
@ CIVIL_DST_AU
Definition
civil_time.h:103
civil_local_offset_min
int civil_local_offset_min(int64_t utc, int std_off_min, int rule)
Offset from UTC in force at utc, DST included.
Definition
civil_time.cpp:194
main
civil_time.h
Generated by
1.17.0