Reputation: 715
It appears to me that my timezone is configured correctly because with
[nix-shell:~]$ date +"%T %Z"
19:49:07 CET
I get what I expect.
But with lua's lgi library I am appearently using Daylight Saving Time,whereas the normal lua functions honour the system settings:
[nix-shell:~]$ lua
Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio
> for k,v in pairs(os.date("*t")) do print(k,v) end
isdst false
sec 31
min 51
month 11
day 12
hour 19
yday 317
wday 5
year 2020
> glib=require"lgi".GLib
> return glib.DateTime.new_now(glib.TimeZone.new()):format("%F %T %Z")
2020-11-12 20:51:52 CEST
Where and how can I make lgi honour my systems timezone/DST settings?
lgi is used by awesome WM for the clock widget, so I want it to be correct.
Upvotes: 1
Views: 264
Reputation: 715
In my particular case my distribution did make a "mistake" when updating the zoneinfo file:
The problem was that the tzdata package did change the file format but the application (in my case aswesome WM) did not support the new format.
The solution was from the distribution was to install the new data files in the old format.
Upvotes: 0
Reputation: 2145
.new_local()
calls .new()
with the correct TZ env variable inside.
https://developer.gnome.org/glib/stable/glib-GTimeZone.html#g-time-zone-new
return glib.DateTime.new_now(glib.TimeZone.new_local()):format("%F %T %Z")
just make sure your TZ environment var is set properly.
https://www.cyberciti.biz/faq/linux-unix-set-tz-environment-variable
you'd think AwesomeWM would figure timezones out automatically, but who knows... OS.date is reporting that you're off DST properly, so would this do it?
if os.date('*t').isdst then
wibox.widget.textclock( timezone='CEST' )
else
wibox.widget.textclock( timezone='CET' )
end
Upvotes: 1