AceTime  2.2.0
Date and time classes for Arduino that support timezones from the TZ Database.
BrokerCommon.h
Go to the documentation of this file.
1 /*
2  * MIT License
3  * Copyright (c) 2019 Brian T. Park
4  */
5 
6 #ifndef ACE_TIME_BROKER_COMMON_H
7 #define ACE_TIME_BROKER_COMMON_H
8 
15 #include <stdint.h>
16 
17 class __FlashStringHelper;
18 
19 namespace ace_time {
20 namespace internal {
30 inline int16_t toDeltaMinutes(uint8_t deltaCode) {
31  return ((int16_t)(deltaCode & 0x0f) - 4) * 15;
32 }
33 
40 inline int16_t toOffsetMinutes(int8_t offsetCode, uint8_t deltaCode) {
41  return (offsetCode * 15) + (((uint8_t)deltaCode & 0xf0) >> 4);
42 }
43 
44 
51 inline uint16_t timeCodeToMinutes(uint8_t code, uint8_t modifier) {
52  return code * (uint16_t) 15 + (modifier & 0x0f);
53 }
54 
60 inline uint8_t toSuffix(uint8_t modifier) {
61  return modifier & 0xf0;
62 }
63 
80 const char* findShortName(const char* name);
81 
86 const __FlashStringHelper* findShortName(const __FlashStringHelper* fname);
87 
88 } // internal
89 } // ace_time
90 
91 #endif
int16_t toOffsetMinutes(int8_t offsetCode, uint8_t deltaCode)
Convert the offsetCode and deltaCode into a signed 16-bit integer that represents the UTCOFF of the Z...
Definition: BrokerCommon.h:40
uint16_t timeCodeToMinutes(uint8_t code, uint8_t modifier)
Convert (code, modifier) fields representing the UNTIL time in ZoneInfo or AT time in ZoneRule in one...
Definition: BrokerCommon.h:51
int16_t toDeltaMinutes(uint8_t deltaCode)
Convert the deltaCode in the ZoneInfo or the ZoneRule struct to the actual deltaMinutes.
Definition: BrokerCommon.h:30
uint8_t toSuffix(uint8_t modifier)
Extract the 'w', 's' 'u' suffix from the 'modifier' field, so that they can be compared against kSuff...
Definition: BrokerCommon.h:60