Skip to content

Commit

Permalink
Fix issue with negative time zone
Browse files Browse the repository at this point in the history
  • Loading branch information
bergdahl committed Jun 9, 2024
1 parent 368a954 commit 4352937
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=JBWopr
version=1.0.4
version=1.0.5
author=Jonny Bergdahl
maintainer=Jonny Bergdahl <[email protected]>
sentence=Support library for the Unexpected Maker W.O.P.R. boards
Expand Down
4 changes: 2 additions & 2 deletions src/jbwoprhelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

bool JBTimeHelper::_isInitialized = false;

uint32_t JBTimeHelper::getUtcOffsetInSeconds() {
int64_t JBTimeHelper::getUtcOffsetInSeconds() {
HTTPClient client;
JBLogger log("timehelper");

Expand All @@ -31,7 +31,7 @@ uint32_t JBTimeHelper::getUtcOffsetInSeconds() {
char sign = offset[0];
int hours = std::stoi(offset.substr(1, 2));
int minutes = std::stoi(offset.substr(4, 2));
float result = hours * 3600 + + minutes * 60.0;
int64_t result = hours * 3600 + + minutes * 60.0;
if (sign == '-') {
result = -result;
}
Expand Down
2 changes: 1 addition & 1 deletion src/jbwoprhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class JBTimeHelper {
/// @brief Get UTC offset in seconds
/// @details Uses https://ipapi.co/timezone/ to get the local UTC offset
/// @return UTC offset in seconds
static uint32_t getUtcOffsetInSeconds();
static int64_t getUtcOffsetInSeconds();

/// @brief Get local time
/// @param info Pointer to tm struct
Expand Down

0 comments on commit 4352937

Please sign in to comment.