AceTime  0.8
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 /*
2  * MIT License
3  * Copyright (c) 2018 Brian T. Park
4  */
5 
6 #if ! defined(UNIX_HOST_DUINO)
7 
8 #include "HardwareDateTime.h"
9 #include "../common/util.h"
10 #include "../common/DateStrings.h"
11 
12 namespace ace_time {
13 
14 using common::printPad2;
15 
16 namespace hw {
17 
18 // Print HardwareDateTime in ISO8601 format
19 void HardwareDateTime::printTo(Print& printer) const {
20  // Date
21  printer.print(F("20"));
22  printPad2(printer, year);
23  printer.print('-');
24  printPad2(printer, month);
25  printer.print('-');
26  printPad2(printer, day);
27  printer.print('T');
28 
29  // Time
30  printPad2(printer, hour);
31  printer.print(':');
32  printPad2(printer, minute);
33  printer.print(':');
34  printPad2(printer, second);
35 
36  // Week day
37  printer.print(DateStrings().dayOfWeekLongString(dayOfWeek));
38 }
39 
40 
41 }
42 }
43 
44 #endif
Class that translates a numeric month (1-12) or dayOfWeek (1-7) into a human readable string...
Definition: DateStrings.h:26
void printTo(Print &printer) const
Print HardwareDateTime to 'printer'.