AceTimeClock  1.2.2
Clock classes for Arduino that can synchronize from an NTP server or an RTC chip
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 
21  static const int16_t kBaseYear = 2000;
22 
24  void printTo(Print& printer) const;
25 
27  uint8_t year;
28 
30  uint8_t month;
31 
33  uint8_t day;
34 
36  uint8_t hour;
37 
39  uint8_t minute;
40 
42  uint8_t second;
43 
45  uint8_t dayOfWeek;
46 };
47 
53 inline bool operator==(const HardwareDateTime& a, const HardwareDateTime& b) {
54  return a.second == b.second
55  && a.minute == b.minute
56  && a.hour == b.hour
57  && a.day == b.day
58  && a.month == b.month
59  && a.year == b.year
60  && a.dayOfWeek == b.dayOfWeek;
61 }
62 
64 inline bool operator!=(const HardwareDateTime& a, const HardwareDateTime& b) {
65  return ! (a == b);
66 }
67 
68 }
69 }
70 
71 #endif
The date (year, month, day) and time (hour, minute, second) fields supported by the DS3231 RTC chip.
static const int16_t kBaseYear
Base year of the DS3231 chip.
uint8_t year
[00, 99], year - 2000
uint8_t dayOfWeek
[1, 7], interpretation undefined, increments every day
void printTo(Print &printer) const
Print HardwareDateTime to 'printer'.