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.
|
6 #include "common/util.h"
7 #include "common/DateStrings.h"
12 using common::printPad2;
13 using common::printPad3;
16 const uint8_t LocalDate::sDayOfWeek[12] = {
32 const uint8_t LocalDate::sDaysInMonth[12] = {
49 printer.print(F(
"<Invalid LocalDate>"));
54 printer.print(
year());
56 printPad2(printer, mMonth);
58 printPad2(printer, mDay);
67 if (strlen(dateString) < kDateStringLength) {
74 const char* s = dateString;
77 int16_t
year = (*s++ -
'0');
86 uint8_t
month = (*s++ -
'0');
93 uint8_t
day = (*s++ -
'0');
94 day = 10 *
day + (*s++ -
'0');
void printTo(Print &printer) const
Print LocalDate to 'printer' in ISO 8601 format, along with the day of week.
static LocalDate forError()
Factory method that returns a LocalDate which represents an error condition.
uint8_t month() const
Return the month with January=1, December=12.
uint8_t dayOfWeek() const
Calculate the day of week given the (year, month, day).
The date (year, month, day) representing the date without regards to time zone.
const char * dayOfWeekLongString(uint8_t dayOfWeek)
Return the short dayOfWeek name.
static LocalDate forDateStringChainable(const char *&dateString)
Variant of forDateString() that updates the pointer to the next unprocessed character.
static LocalDate forDateString(const char *dateString)
Factory method.
Class that translates a numeric month (1-12) or dayOfWeek (1-7) into a human readable string.
uint8_t day() const
Return the day of the month.
bool isError() const
Return true if any component indicates an error condition.
static LocalDate forComponents(int16_t year, uint8_t month, uint8_t day)
Factory method using separated year, month and day fields.
int16_t year() const
Return the full year instead of just the last 2 digits.