Fix localtz() function

Closes-Bug: #2052593
Change-Id: I739b44829202f0edba94ff502cd06e6cba60a4d0
This commit is contained in:
Radovan Pieter 2024-02-07 12:09:27 +01:00 committed by Takashi Kajinami
parent 0d63eb1346
commit 269f966996
2 changed files with 7 additions and 1 deletions

View File

@ -0,0 +1,6 @@
---
fixes:
- |
The localtz YAQL function now returns daylight saving time when daylight
saving is actually enabled in the system. Previously it returned daylight
saving time if the system time zone has daylight saving time.

View File

@ -322,7 +322,7 @@ def localtz():
yaql> localtz().hours
3.0
"""
if python_time.daylight:
if python_time.localtime().tm_isdst:
return TIMESPAN_TYPE(seconds=-python_time.altzone)
else:
return TIMESPAN_TYPE(seconds=-python_time.timezone)