AceTime  1.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.
ExtendedZone.h
1 /*
2  * MIT License
3  * Copyright (c) 2019 Brian T. Park
4  */
5 
6 #ifndef ACE_TIME_EXTENDED_ZONE_H
7 #define ACE_TIME_EXTENDED_ZONE_H
8 
9 #include "internal/ZoneInfo.h"
10 #include "internal/Brokers.h"
11 #include "common/compat.h"
12 
13 class __FlashStringHelper;
14 
15 namespace ace_time {
16 
23 class ExtendedZone {
24  public:
25  ExtendedZone(const extended::ZoneInfo* zoneInfo):
26  mZoneInfoBroker(zoneInfo) {}
27 
28 // TODO: Merge this with BasicZone.h now that they both use the same
29 // ACE_TIME_USE_PROGMEM macro.
30 #if ACE_TIME_USE_PROGMEM
31  const __FlashStringHelper* name() const {
32  return (const __FlashStringHelper*) mZoneInfoBroker.name();
33  }
34 
35  const __FlashStringHelper* shortName() const {
36  const char* name = mZoneInfoBroker.name();
37  const char* slash = strrchr_P(name, '/');
38  return (slash) ? (const __FlashStringHelper*) (slash + 1)
39  : (const __FlashStringHelper*) name;
40  }
41 #else
42  const char* name() const {
43  return mZoneInfoBroker.name();
44  }
45 
46  const char* shortName() const {
47  const char* name = mZoneInfoBroker.name();
48  const char* slash = strrchr(name, '/');
49  return (slash) ? (slash + 1) : name;
50  }
51 #endif
52 
53  uint32_t zoneId() const {
54  return mZoneInfoBroker.zoneId();
55  }
56 
57  private:
58  // disable copy constructor and assignment operator
59  ExtendedZone(const ExtendedZone&) = delete;
60  ExtendedZone& operator=(const ExtendedZone&) = delete;
61 
62  const extended::ZoneInfoBroker mZoneInfoBroker;
63 };
64 
65 }
66 
67 #endif
ace_time::ExtendedZone
A thin wrapper around an extended::ZoneInfo data structure to provide a stable API access to some use...
Definition: ExtendedZone.h:23
Brokers.h
compat.h
ace_time::extended::ZoneInfoBroker
Data broker for accessing ZoneInfo.
Definition: Brokers.h:679