AceTime
1.7.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.
|
6 #ifndef ACE_TIME_TIME_OFFSET_H
7 #define ACE_TIME_TIME_OFFSET_H
19 namespace time_offset_mutation {
78 int16_t minutes = hour * 60 + minute;
126 hour = mMinutes / 60;
127 minute = mMinutes % 60;
135 bool isZero()
const {
return mMinutes == 0; }
143 void printTo(Print& printer)
const;
153 friend void time_offset_mutation::incrementHour(
TimeOffset& offset);
154 friend void time_offset_mutation::increment15Minutes(
TimeOffset& offset);
157 static const uint8_t kTimeOffsetStringLength = 6;
164 void setMinutes(int16_t minutes) {
174 int16_t mMinutes = 0;
177 inline bool operator==(
const TimeOffset& a,
const TimeOffset& b) {
178 return a.mMinutes == b.mMinutes;
181 inline bool operator!=(
const TimeOffset& a,
const TimeOffset& b) {
static TimeOffset forError()
Return an error indicator.
bool isError() const
Return true if this TimeOffset represents an error.
static TimeOffset forOffsetStringChainable(const char *&offsetString)
Variant of forOffsetString() that updates the string pointer to the next unprocessed character.
int32_t toSeconds() const
Return the time offset as seconds.
static TimeOffset forOffsetString(const char *offsetString)
Create from an offset string ("-07:00" or "+01:00").
A thin wrapper that represents a time offset from a reference point, usually 00:00 at UTC,...
void printTo(Print &printer) const
Print the human readable string.
int16_t toMinutes() const
Return the time offset as minutes.
void incrementHour(TimePeriod &period, uint8_t limit)
Increment the hour by one, modulo 'limit'.
static TimeOffset forHourMinute(int8_t hour, int8_t minute)
Create TimeOffset from (hour, minute) offset.
static TimeOffset forMinutes(int16_t minutes)
Create TimeOffset from minutes from 00:00.
void toHourMinute(int8_t &hour, int8_t &minute) const
Extract hour and minute representation of the offset.
static const int16_t kErrorMinutes
Sentinel value that represents an error.
static TimeOffset forHours(int8_t hours)
Create TimeOffset with the corresponding hour offset.
bool isZero() const
Returns true if offset is 00:00.
void increment15Minutes(TimeOffset &offset)
Increment the TimeOffset by 15 minute interval.