On 05/12/2023 05:14, Pocket wrote:
For gene..................................................................
[...]
zone=EST5EDT
zoneinfo=/usr/share/zoneinfo
localtime=/etc/localtime
timezone=/etc/timezone
profile=/etc/profile.d
if [ -e "$zoneinfo"/"$zone" ];then
ln -sf "$zoneinfo"/"$zone" "$localtime"
else
printf "%s\n" "Invalid zone: $zoneinfo/$zone"
exit 1
fi
printf "%s\n" "$zone" > "$timezone"
printf "%s\n" "TZ=$zone;export TZ" > "$profile"/timezone.sh
To set /etc/localtime and /etc/timezone I would recommend the command
that has been repeated several times in this thread:
dpkg-reconfigure tzdata
And I would recommend against setting the TZ environment variable unless
it is really necessary. If somebody needs it then it is better to do it
in /etc/environment.d as well. KDE has its own GUI to set user-specific
timezone, but I am unsure if selected value will be applied in the case
of console or ssh login.
I am surprised that POSIX EST5EDT timezone has irregularities at least
as it is implemented in GNU libc. I believed that it specifies just
standard and summer time.
LANG=C.UTF-8 TZ=EST5EDT date -d 'TZ="Z" 1940-01-01 00:00'
Sun Dec 31 19:00:00 EST 1939
LANG=C.UTF-8 TZ=EST5EDT date -d 'TZ="Z" 1943-01-01 00:00'
Thu Dec 31 20:00:00 EWT 1942
However since these rules are specific to US, I would prefer IANA
identifiers like America/New_York.
https://naggum.no/lugm-time.html
Erik Naggum. A Long, Painful History of Time. 1999
8.2 Timezone Representation
David Olsen of Digital Equipment Corporation has laid down a tremendous
amount of work in collecting the timezones of the world and their
daylight saving time boundaries. Contrary to the Unix System V approach
from New Jersey (insert appropriate booing for best effect), which
codifies a daylight saving time regime only for the current year, and
apply it to all years, David Olsen's approach is to maintain tables of
all the timezone changes.