AceTime
1.1.2
Date and time classes for Arduino that support timezones from the TZ Database, and a system clock that can synchronize from an NTP server or an RTC chip.
src
ace_time
hw
HardwareDateTime.h
1
/*
2
* MIT License
3
* Copyright (c) 2018 Brian T. Park
4
*/
5
6
#ifndef ACE_TIME_HW_DATE_TIME_H
7
#define ACE_TIME_HW_DATE_TIME_H
8
9
#include <stdint.h>
10
#include <Print.h>
// Print
11
#include "../common/util.h"
12
13
namespace
ace_time {
14
namespace
hw {
15
20
struct
HardwareDateTime
{
22
void
printTo
(Print& printer)
const
;
23
24
uint8_t year;
// [00, 99], year - 2000
25
uint8_t month;
// [1, 12]
26
uint8_t day;
// [1, 31]
27
uint8_t hour;
// [0, 23]
28
uint8_t minute;
// [0, 59]
29
uint8_t second;
// [0, 59]
30
uint8_t dayOfWeek;
// [1, 7], interpretation undefined, increments every day
31
};
32
38
inline
bool
operator==(
const
HardwareDateTime
& a,
const
HardwareDateTime
& b) {
39
return
a.second == b.second
40
&& a.minute == b.minute
41
&& a.hour == b.hour
42
&& a.day == b.day
43
&& a.month == b.month
44
&& a.year == b.year
45
&& a.dayOfWeek == b.dayOfWeek;
46
}
47
49
inline
bool
operator!=(
const
HardwareDateTime& a,
const
HardwareDateTime& b) {
50
return
! (a == b);
51
}
52
53
}
54
}
55
56
#endif
ace_time::hw::HardwareDateTime::printTo
void printTo(Print &printer) const
Print HardwareDateTime to 'printer'.
Definition:
HardwareDateTime.cpp:19
ace_time::hw::HardwareDateTime
The date (year, month, day) and time (hour, minute, second) fields supported by the DS3231 RTC chip.
Definition:
HardwareDateTime.h:20
Generated by
1.8.17