AceTime
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
12
namespace
ace_time {
13
namespace
hw {
14
19
struct
HardwareDateTime
{
21
void
printTo
(Print& printer)
const
;
22
23
uint8_t year;
// [00, 99], year - 2000
24
uint8_t month;
// [1, 12]
25
uint8_t day;
// [1, 31]
26
uint8_t hour;
// [0, 23]
27
uint8_t minute;
// [0, 59]
28
uint8_t second;
// [0, 59]
29
uint8_t dayOfWeek;
// [1, 7], interpretation undefined, increments every day
30
};
31
37
inline
bool
operator==(
const
HardwareDateTime
& a,
const
HardwareDateTime
& b) {
38
return
a.second == b.second
39
&& a.minute == b.minute
40
&& a.hour == b.hour
41
&& a.day == b.day
42
&& a.month == b.month
43
&& a.year == b.year
44
&& a.dayOfWeek == b.dayOfWeek;
45
}
46
48
inline
bool
operator!=(
const
HardwareDateTime& a,
const
HardwareDateTime& b) {
49
return
! (a == b);
50
}
51
52
}
53
}
54
55
#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:19
Generated by
1.8.17