AceTime  2.3.0
Date and time classes for Arduino that support timezones from the TZ Database.
BasicZone.cpp
1 /*
2  * MIT License
3  * Copyright (c) 2019 Brian T. Park
4  */
5 
6 #include <Arduino.h>
7 #include <AceCommon.h> // KString
8 #include "../zoneinfo/BrokerCommon.h" // findShortName()
9 #include "BasicZone.h"
10 
11 using ace_common::KString;
12 using ace_common::printReplaceCharTo;
13 using ace_time::zoneinfo::findShortName;
15 
16 namespace ace_time {
17 
18 void BasicZone::printNameTo(Print& printer) const {
19  const __FlashStringHelper* name = mZoneInfoBroker.name();
20  ZoneContextBroker zoneContext = mZoneInfoBroker.zoneContext();
21  KString kname(name, zoneContext.fragments(), zoneContext.numFragments());
22  kname.printTo(printer);
23 }
24 
25 void BasicZone::printShortNameTo(Print& printer) const {
26  const __FlashStringHelper* name = mZoneInfoBroker.name();
27  const __FlashStringHelper* shortName = findShortName(name);
28  printReplaceCharTo(printer, shortName, '_', ' ');
29 }
30 
31 } // ace_time
ace_common::KString kname() const
Return the name as a KString.
Definition: BasicZone.h:70
void printShortNameTo(Print &printer) const
Print the short pretty zone name to the printer.
Definition: BasicZone.cpp:25
void printNameTo(Print &printer) const
Print the full zone name to printer.
Definition: BasicZone.cpp:18
Data broker for accessing a ZoneContext.
Definition: BrokersLow.h:91