mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
fix: report half-hour time zones correctly in ISO timestamps
calcTZOffset added the leftover seconds instead of minutes to the hhmm offset, so +05:30 came out as 2300 and ISO timestamps showed +2300. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
aa23b4624d
commit
02df2daaab
1 changed files with 2 additions and 1 deletions
|
|
@ -120,8 +120,9 @@ int Timestamp::calcTZOffset(time_t *dt) {
|
||||||
localtime_r(dt, &tmLocal);
|
localtime_r(dt, &tmLocal);
|
||||||
long diff = mktime(&tmLocal) - mktime(&tmUTC);
|
long diff = mktime(&tmLocal) - mktime(&tmUTC);
|
||||||
if(tmLocal.tm_isdst) diff += 3600;
|
if(tmLocal.tm_isdst) diff += 3600;
|
||||||
|
// Encoded as hhmm, e.g. +05:30 is 530 and -03:30 is -330.
|
||||||
int hrs = (int)((diff/3600) * 100);
|
int hrs = (int)((diff/3600) * 100);
|
||||||
int mins = diff - (hrs * 36);
|
int mins = (int)((diff % 3600) / 60);
|
||||||
return hrs + mins;
|
return hrs + mins;
|
||||||
}
|
}
|
||||||
int Timestamp::tzOffset() {
|
int Timestamp::tzOffset() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue