8 #include "common/DateStrings.h"
9 #include "TimeOffset.h"
11 using ace_common::printPad2To;
29 printPad2To(printer, hour,
'0');
31 printPad2To(printer, minute,
'0');
34 printPad2To(printer, second,
'0');
40 uint8_t len = strlen(offsetString);
41 if (len != 6 && len != 9) {
49 const char* s = offsetString;
53 if (sign !=
'-' && sign !=
'+') {
58 int8_t hour = (*s++ -
'0');
59 hour = 10 * hour + (*s++ -
'0');
63 int8_t minute = (*s++ -
'0');
64 minute = 10 * minute + (*s++ -
'0');
70 second = (*s++ -
'0');
71 second = 10 * second + (*s++ -
'0');
A thin wrapper that represents a time offset from a reference point, usually 00:00 at UTC,...
void toHourMinuteSecond(int8_t &hour, int8_t &minute, int8_t &second) const
Extract hour, minute, second from the offset.
static TimeOffset forOffsetString(const char *offsetString)
Create from an offset string (e.g.
static TimeOffset forError()
Return an error indicator.
static TimeOffset forHourMinuteSecond(int8_t hour, int8_t minute, int8_t second)
Create a TimeOffset fro (hour, minute, second) offset.
void printTo(Print &printer) const
Print the human readable string, including a "-" or "+" prefix, in the form of "+/-hh:mm" or "+/-hh:m...
static TimeOffset forOffsetStringChainable(const char *&offsetString)
Variant of forOffsetString() that updates the string pointer to the next unprocessed character.