Fix: set env var TZ
correctly to prevent excessive stat
syscalls
#6084
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The changes set the local timezone environment variable
TZ
, taking the local time settings into account. To determine the timezone, file/etc/timezone
is checked and the respective value used, if existent. Alternatively, i case a previous timezone was already saved in the DB, it is used; fallback isEtc/GMT
. The set value will be visible in the debug log as well as in Phoscon's advanced Gateway settings.To actually set
TZ
on OS level, the value remains untouched if the variable exists. Alternatively, it is populated with/etc/localtime
, the previously determined timezone or the fallback as above.This has been tested on a Ubuntu 18.04 LTS and RaspbianOS Buster. The timezone gets apparently set appropriately, as the
stat
calls were reduced to just a few.It should be seperately tested if and to what extend that might apply to Windows environments as well.