#19901: date from openwrt
--------------------------+------------------------
Reporter: anonymous | Owner: developers
Type: defect | Status: new
Priority: normal | Milestone:
Component: base system | Version: Trunk
Resolution: | Keywords:
--------------------------+------------------------
Comment (by hnyman):
Confirmed. I have the same problem.
trunk r45989 works ok, but already r45006 shows the GMT time both in Luci
and in console.
When looking at the trunk changes between those revisions, the
uclibc-->musl is an obvious candidate.
Apparently musl (or busybox with musl???) doesn't export TZ variable
similarly as with uclibc.
I found discussion from November 2014 and tested the advice there:
https://lists.openwrt.org/pipermail/openwrt-
devel/2014-November/thread.html#29296
{{{
Currently the boot scripts in OpenWRT parse /etc/config/system and save
the
timezone in /tmp/TZ.
The code in uClibc looks for a TZ variable in the environment and if it
doesn't
find it, it tries to read /etc/TZ, a symlink that points to /tmp/TZ and
everything works.
Musl libc however doesn't work this way: it doesn't try to load /etc/TZ.
It looks for a TZ env variable and if it doesn't find it, it resorts to
canonical zoneinfo files. The timezone in /tmp/TZ is ignored.
I cooked up a patch to make musl libc read the /etc/TZ file, however I
don't
think this is an efficient solution since it resorts to read data from the
filesystem. A simpler getenv("TZ") wouldn't need to access the fs at all.
So in my opinion the "better" fix would be to populate the TZ environment
variable.
With the current setup I simply added the following line to /etc/profile:
[ -f /tmp/TZ ] && export TZ=$(cat /tmp/TZ)
}}}
That proposal did not get Openwrt developers' acceptance, but seems to
help, as shown below. But I am not sure if the discussion or possible
patches have progressed since then.
Following the advice and exporting TZ variable helps:
{{{
Dxxx Dxxx (Bleeding Edge, r46005)
-----------------------------------------------------
root@OpenWrt2:~# uptime
08:24:54 up 1 min, load average: 0.62, 0.26, 0.09
root@OpenWrt2:~# cat /tmp/TZ
EET-2EEST,M3.5.0/3,M10.5.0/4
root@OpenWrt2:~# env
... (No TZ)
root@OpenWrt2:~# export TZ=$(cat /tmp/TZ)
root@OpenWrt2:~# env
...
TZ=EET-2EEST,M3.5.0/3,M10.5.0/4
root@OpenWrt2:~# uptime
11:35:19 up 11 min, load average: 0.00, 0.03, 0.04
}}}
--
Ticket URL: <https://dev.openwrt.org/ticket/19901#comment:1>
OpenWrt <http://openwrt.org>
Opensource Wireless Router Technology
_______________________________________________
openwrt-tickets mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-tickets