My knowledge on Linux is limited, so please forgive me if this is something obvious. When running Syncthing with -logflags=3, both date and time are written to the logfile. The problem is that they follow the UTC time, not the local time, which makes things difficult when you need to compare the logs between Linux and Windows devices (since the latter use local time instead).
Is there a simple way to make Syncthing use local time instead of UTC in logfile?
So maybe check that you have a valid time zone database installed. (“UTC1” and “UTC0” are also not things recognized by my systems, both instead being parsed as just “UTC”.) That date echoes your time zone doesn’t mean much.
$ TZ=trololol date
Sun Aug 8 14:35:17 trololol 2021
(That’s UTC, because the time zone trololol doesn’t actually exist in the database.)
I didn’t mean the name, but rather the time being changed, e.g.
$ TZ=UTC0 date
Sun Aug 8 14:40:12 UTC 2021
$ TZ=UTC1 date
Sun Aug 8 13:40:59 UTC 2021
$ TZ=UTC-5 date
Sun Aug 8 19:40:39 UTC 2021
The database is there and works though, e.g.
$ TZ=America/Montevideo date
Sun Aug 8 11:42:19 -03 2021
However, I think that I have found the culprit. I have the problem on Android, but for some reason I believed it to be a general Linux issue (hence the general support category, which I’m going to change after this post).
In reality, the problem seems to be specifically time: time.Local is always UTC on Android · Issue #20455 · golang/go · GitHub, which is basically about Golang always using UTC when the OS is Android, completely ignoring the TZ variable. I have tried to fiddle around with the Go source timezone files related to Android trying to perhaps hardcode my own timezone instead of UTC, but I couldn’t get it to work in the actual Syncthing binary, which still displays the time in UTC.
It’s fascinating that date a) apparently does something with those timezones yet prints them all as “UTC” and b) uses the wrong adjustment direction, i.e. you say “UTC-5” but it in fact returns UTC+5. I have no idea what’s going on, and no real desire to either.
but the above isn’t limited to that, my Mac does the same.
Yeah, my main goal here is not have TZ working, just to somehow make Syncthing use the local time instead of UTC. As long as the Go issue stands, there is no way to override the time zone value used in the logfile, right?