AceTime  0.3
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.
HardwareDateTime.cpp
1 #if defined(ARDUINO)
2 
3 #include "HardwareDateTime.h"
4 #include "../common/util.h"
5 #include "../common/DateStrings.h"
6 
7 namespace ace_time {
8 
9 using common::printPad2;
10 using common::DateStrings;
11 
12 namespace hw {
13 
14 // Print HardwareDateTime in ISO8601 format
15 void HardwareDateTime::printTo(Print& printer) const {
16  // Date
17  printer.print(F("20"));
18  printPad2(printer, year);
19  printer.print('-');
20  printPad2(printer, month);
21  printer.print('-');
22  printPad2(printer, day);
23  printer.print('T');
24 
25  // Time
26  printPad2(printer, hour);
27  printer.print(':');
28  printPad2(printer, minute);
29  printer.print(':');
30  printPad2(printer, second);
31 
32  // Week day
33  printer.print(DateStrings().dayOfWeekLongString(dayOfWeek));
34 }
35 
36 
37 }
38 }
39 
40 #endif