[projects/pld-builder.new] request: print the UTC offset in effect at the request time
arekm
arekm at pld-linux.org
Mon Oct 26 17:16:51 CET 2026
commit 2657ee9ba0df0710879753dcb9685f8705df236a
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sat Oct 24 11:34:15 2026 +0200
request: print the UTC offset in effect at the request time
Winter times read +0200 and half-hour zones came out wrong.
PLD_Builder/request.py | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
---
diff --git a/PLD_Builder/request.py b/PLD_Builder/request.py
index f10a874..3a1b052 100644
--- a/PLD_Builder/request.py
+++ b/PLD_Builder/request.py
@@ -53,16 +53,8 @@ def escape(s):
# return timestamp with timezone information
# so we could parse it in javascript
def tzdate(t):
- # as strftime %z is unofficial, and does not work, need to make it numeric ourselves
- date = time.strftime("%a %b %d %Y %H:%M:%S", time.localtime(t))
- # NOTE: the altzone is showing CURRENT timezone, not what the "t" reflects
- # NOTE: when DST is off timezone gets it right, altzone not
- if time.daylight:
- tzoffset = time.altzone
- else:
- tzoffset = time.timezone
- tz = '%+05d' % (-tzoffset / 3600 * 100)
- return date + ' ' + tz
+ # %z of localtime(t) is the offset in effect at t, DST included
+ return time.strftime("%a %b %d %Y %H:%M:%S %z", time.localtime(t))
# return date in iso8601 format
def iso8601(ts, timezone='UTC'):
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/ce9feb3c796ed049b6dd260a50d94d80feb1656d
More information about the pld-cvs-commit
mailing list