AceTime 2.4.0 Date and time classes for Arduino that support timezones from the TZ Database.

CompleteZone.cpp
1 /*
2 * MIT License
3 * Copyright (c) 2023 Brian T. Park
4 */
5
6 #include <Arduino.h>
7 #include <AceCommon.h> // KString
8 #include "../zoneinfo/BrokerCommon.h" // findShortName()
9 #include "CompleteZone.h"
10
11 using ace_common::KString;
12 using ace_common::printReplaceCharTo;
13 using ace_time::zoneinfo::findShortName;
14 using ace_time::complete::ZoneContextBroker;
15
16 namespace ace_time {
17
18 void CompleteZone::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 CompleteZone::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_time::CompleteZone::kname
ace_common::KString kname() const
Return the name as a KString.
Definition: CompleteZone.h:71
ace_time::CompleteZone::printShortNameTo
void printShortNameTo(Print &printer) const
Print the short pretty zone name to the printer.
Definition: CompleteZone.cpp:25
ace_time::CompleteZone::printNameTo
void printNameTo(Print &printer) const
Print the full zone name to printer.
Definition: CompleteZone.cpp:18
ace_time::zoneinfohigh::ZoneContextBroker
Data broker for accessing a ZoneContext.
Definition: BrokersHigh.h:81