Incorrect timezone offset calculation in setDateTime() in _GXCommon.py
Current code:
d = int(dt.value.utcoffset().seconds / 60)
Should be:
d = int(dt.value.utcoffset().total_seconds() / 60)
Reason:
timedelta.seconds does not preserve the sign of the timedelta. It returns only the seconds component in the range 0...86399.
For example, for UTC-3 offset:
timedelta(seconds=-10800).seconds
returns 75600 instead of -10800.
As a result, negative UTC offsets are encoded incorrectly.
total_seconds() correctly preserves the sign of the offset.
Hi, Thank you for pointing…
Hi,
Thank you for pointing this out. It was easy to verify with the current time and a negative time zone.
dt = datetime(2026, 8, 17, 12, 0, 0,tzinfo=timezone(timedelta(hours=-3)))
This is fixed in version 1.0.202, and your name is added to the credits.
Regards,
Mikko