AceTime  0.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.
TimeZone.cpp
1 #include <Print.h>
2 #include "common/util.h"
3 #include "TimeZone.h"
4 
5 namespace ace_time {
6 
7 void TimeZone::printTo(Print& printer) const {
8  if (mType == kTypeFixed) {
9  if (mOffset.isZero()) {
10  printer.print("UTC");
11  } else{
12  mOffset.printTo(printer);
13  }
14  } else {
15  mZoneSpecifier->printTo(printer);
16  }
17 }
18 
19 void TimeZone::printAbbrevTo(Print& printer, acetime_t epochSeconds) const {
20  if (mType == kTypeFixed) {
21  if (mOffset.isZero()) {
22  printer.print("UTC");
23  } else{
24  mOffset.printTo(printer);
25  }
26  } else {
27  printer.print(mZoneSpecifier->getAbbrev(epochSeconds));
28  }
29 }
30 
31 }
virtual void printTo(Print &printer) const =0
Print a human-readable identifier.
const ZoneSpecifier * mZoneSpecifier
Used if mType == mTypeZoneSpecifier.
Definition: TimeZone.h:245
void printTo(Print &printer) const
Print the human readable string.
Definition: TimeOffset.cpp:10
void printTo(Print &printer) const
Print the human readable representation of the time zone.
Definition: TimeZone.cpp:7
TimeOffset mOffset
Used if mType == mTypeFixed.
Definition: TimeZone.h:242
bool isZero() const
Returns true if offset is 00:00.
Definition: TimeOffset.h:147
void printAbbrevTo(Print &printer, acetime_t epochSeconds) const
Print the time zone abbreviation for the given epochSeconds.
Definition: TimeZone.cpp:19
virtual const char * getAbbrev(acetime_t epochSeconds) const =0
Return the time zone abbreviation at epochSeconds.