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:
cjkas 2026-10-11 12:54:56 +02:00
parent aa23b4624d
commit 02df2daaab

View file

@ -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() {