Hacker News new | ask | show | jobs
by stormbrew 3401 days ago
Are you talking about DST? You don't change your timezone at DST switch, the timezone data knows how to calculate the correct time based on your location (roughly) and the time of year. Mountain standard time and mountain daylight time are both part of mountain time, for example.
1 comments

What I meant was: Currently my timezone is CET. In a month's time it will be CEST. If I have to set TZ to explicitly mirror that it will be a burden.
TZ may be set like this:

   TZ=:Europe/Copenhagen
Replace Europe/Copenhagen with the appropriate entry from the list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

Usually, /etc/localtime is a symlink, as on my laptop:

  /etc/localtime -> /usr/share/zoneinfo/Europe/Copenhagen
so TZ=:/etc/localtime has the same result.

You can demonstrate that it takes account of changes to timezones:

Normal time for London:

  $ TZ=:Europe/London date -d '1995-12-30 12:00 UTC' -R
  Sat, 30 Dec 1995 12:00:00 +0000
British Summer Time:

  $ TZ=:Europe/London date -d '1995-06-30 12:00 UTC' -R
  Fri, 30 Jun 1995 13:00:00 +0100
'Double British Summer Time', used for a period during World War 2:

  $ TZ=:Europe/London date -d '1945-06-30 12:00 UTC' -R
  Sat, 30 Jun 1945 14:00:00 +0200
Before London's time was standardized to Greenwich:

  $ TZ=:Europe/London date -d '1845-06-30 12:00 UTC' -R
  Mon, 30 Jun 1845 11:58:45 -0001
wait, so when I did `echo $TZ`, to check, and got `Europe/Amsterdam` that means it's already properly and I did't need to set it to `:/etc/localtime`?

this is not a part of Linux I'm very familiar with

Thanks!