BLE CTS: fixed signedness of timezone

This commit is contained in:
uli 2022-11-23 12:41:28 +01:00 committed by JF
parent f1d2a8ee50
commit 02116a2fd4
3 changed files with 9 additions and 9 deletions

View File

@ -47,8 +47,8 @@ namespace Pinetime {
} CtsCurrentTimeData; } CtsCurrentTimeData;
typedef struct __attribute__((packed)) { typedef struct __attribute__((packed)) {
uint8_t timezone; int8_t timezone;
uint8_t dst; int8_t dst;
} CtsLocalTimeData; } CtsLocalTimeData;
DateTime& m_dateTimeController; DateTime& m_dateTimeController;

View File

@ -51,7 +51,7 @@ void DateTime::SetTime(uint16_t year,
systemTask->PushMessage(System::Messages::OnNewTime); systemTask->PushMessage(System::Messages::OnNewTime);
} }
void DateTime::SetTimeZone(uint8_t timezone, uint8_t dst) { void DateTime::SetTimeZone(int8_t timezone, int8_t dst) {
tzOffset = timezone; tzOffset = timezone;
dstOffset = dst; dstOffset = dst;
} }

View File

@ -48,7 +48,7 @@ namespace Pinetime {
* timezone is expected to be constant over DST which will be reported in * timezone is expected to be constant over DST which will be reported in
* dst field. * dst field.
*/ */
void SetTimeZone(uint8_t timezone, uint8_t dst); void SetTimeZone(int8_t timezone, int8_t dst);
void UpdateTime(uint32_t systickCounter); void UpdateTime(uint32_t systickCounter);
uint16_t Year() const { uint16_t Year() const {
@ -80,7 +80,7 @@ namespace Pinetime {
* supports the BLE CTS Local Time Characteristic. Expect it to be 0 * supports the BLE CTS Local Time Characteristic. Expect it to be 0
* if not. * if not.
*/ */
uint8_t UtcOffset() const { int8_t UtcOffset() const {
return tzOffset + dstOffset; return tzOffset + dstOffset;
} }
@ -92,7 +92,7 @@ namespace Pinetime {
* supports the BLE CTS Local Time Characteristic. Expect it to be 0 * supports the BLE CTS Local Time Characteristic. Expect it to be 0
* if not. * if not.
*/ */
uint8_t TzOffset() const { int8_t TzOffset() const {
return tzOffset; return tzOffset;
} }
@ -105,7 +105,7 @@ namespace Pinetime {
* supports the BLE CTS Local Time Characteristic. Expect it to be 0 * supports the BLE CTS Local Time Characteristic. Expect it to be 0
* if not. * if not.
*/ */
uint8_t DstOffset() const { int8_t DstOffset() const {
return dstOffset; return dstOffset;
} }
@ -136,8 +136,8 @@ namespace Pinetime {
uint8_t hour = 0; uint8_t hour = 0;
uint8_t minute = 0; uint8_t minute = 0;
uint8_t second = 0; uint8_t second = 0;
uint8_t tzOffset = 0; int8_t tzOffset = 0;
uint8_t dstOffset = 0; int8_t dstOffset = 0;
uint32_t previousSystickCounter = 0; uint32_t previousSystickCounter = 0;
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> currentDateTime; std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> currentDateTime;