On musl, the way to set the timezone is by having a TZ environment variable.
See its documentation for reference.
Currently, when running exa -l, the following output appears on such a system:
Unable to determine time zone: No such file or directory (os error 2)
Note that date (both GNU and busybox implementation) output the correct time information with no warnings:
Fri Dec 14 00:13:10 EST 2018
I checked the code and exa does not read the TZ environment variable. Instead it tries to get the timezone from /etc/localtime. So this isn't an issue with musl libc more of a general missing feature.
Could you edit the title to reflect that exa does not read the TZ environment variable but probably should.
This would be a very localized change in src/output/table.rs:266. So it might be a good first issue if someone wants to give it a try.
Note: on termux (the android terminal emulator), by default neither $TZ nor /etc/localtime are available.
It seems it has timezone info at /system/usr/share/zoneinfo/tzdata. Not sure how to get that path from exa. The environment only has ANDROID_ROOT=/system ; but I don't know _when_ we should look for this.
I've come across this issue also. Happy to test solutions if someone can walk me through it. I only use termux to play around on so i'm not worried about breaking it.
Creating a localtime file in /etc/ folder with proper timezone will eliminates this problem. I have alpine on termux and there was no /etc/localtime file so I did as follows:
apk add tzdata
cat '/usr/share/zoneinfo/Asia/Calcutta' > /etc/localtime
It worked for me.
The bug is about reading the TZ environment variable, not about parsing /etc/localtime.
I've created a pull request that will have exa first check the TZ environment variable before defaulting to /etc/localtime. This will work on linux distros that store timezone data in /usr/share/zoneinfo.
Termux on Android still poses a problem since timezone data is instead stored in one large file: /system/usr/share/zoneinfo/tzdata, but it's out of the scope of this issue.
Most helpful comment
I checked the code and exa does not read the TZ environment variable. Instead it tries to get the timezone from
/etc/localtime. So this isn't an issue with musl libc more of a general missing feature.Could you edit the title to reflect that exa does not read the TZ environment variable but probably should.
This would be a very localized change in
src/output/table.rs:266. So it might be a good first issue if someone wants to give it a try.