9 #include "common/DateStrings.h"
10 #include "LocalDateTime.h"
12 using ace_common::printPad2To;
18 printer.print(F(
"<Invalid LocalDateTime>"));
23 printer.print(mLocalDate.
year());
25 printPad2To(printer, mLocalDate.
month(),
'0');
27 printPad2To(printer, mLocalDate.
day(),
'0');
33 printPad2To(printer, mLocalTime.
hour(),
'0');
35 printPad2To(printer, mLocalTime.
minute(),
'0');
37 printPad2To(printer, mLocalTime.
second(),
'0');
41 if (strlen(dateString) < kDateTimeStringLength) {
48 const __FlashStringHelper* dateString) {
52 char buffer[kDateTimeStringLength + 2];
53 strncpy_P(buffer, (
const char*) dateString,
sizeof(buffer));
54 buffer[kDateTimeStringLength + 1] = 0;
57 size_t len = strlen(buffer);
58 if (len > kDateTimeStringLength) {
66 const char* s = dateString;
Class that holds the date-time as the components (year, month, day, hour, minute, second) without reg...
void printTo(Print &printer) const
Print LocalDateTime to 'printer' in ISO 8601 format.
LocalDateTime()
Constructor.
bool isError() const
Return true if any component indicates an error condition.
static LocalDateTime forError()
Factory method that returns an instance where isError() returns true.
static LocalDateTime forDateString(const char *dateString)
Factory method.
static LocalDateTime forDateStringChainable(const char *&dateString)
Variant of forDateString() that updates the pointer to the next unprocessed character.
The date (year, month, day) representing the date without regards to time zone.
int16_t year() const
Return the year.
static LocalDate forDateStringChainable(const char *&dateString)
Variant of forDateString() that updates the pointer to the next unprocessed character.
uint8_t month() const
Return the month with January=1, December=12.
uint8_t day() const
Return the day of the month.
The time (hour, minute, second) fields representing the time without regards to the day or the time z...
static LocalTime forTimeStringChainable(const char *&timeString)
Variant of forTimeString() that updates the pointer to the next unprocessed character.
uint8_t hour() const
Return the hour.
uint8_t minute() const
Return the minute.
uint8_t second() const
Return the second.