question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider checking which timezone path the system uses

See original GitHub issue

I use Arch, which sets the timezone via the /etc/localtime symbolic link.

Recently I had a calendar program which was displaying events in the wrong timezone, despite things like date and timedatectl showing the correct timezone. I couldn’t figure out where it was getting the incorrect configuration from.

As it turns out, I had run tzupdate when I was in a different timezone, which both set the /etc/localtime link and wrote the timezone to /etc/timezone. Later, when I returned to my home timezone, I changed the timezone back using a different method, such that /etc/localtime was correct but the /etc/timezone file that tzupdate created still showed the wrong timezone. This was where the calendar program was getting the incorrect date from.

It would be nice if tzupdate only modified the file used by the system. The easiest solution would be to not touch either file unless they already exist, but I see in #11 that tzupdate intentionally accounts for the odd case of a system which has no timezone configured yet.

Instead, maybe the best option is to check /etc/issue, if the contents look Debian-ish set /etc/timezone, otherwise set /etc/localtime.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pigmonkeycommented, Jun 7, 2019

Yeah, I poked around on an Ubuntu box I have and it looks like it does need both, so I think always setting /etc/localtime and saving the conditional just for /etc/timezone makes sense.

0reactions
cdowncommented, Jun 7, 2019

Thanks for taking a look.

06646ee094536a984645626274607334db4043a6 should implement this for future cases, although for boxes with /etc/timezone already on, it will need to be manually removed.

Thanks for the report!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to check which timezone in Linux? - Super User
The default system timezone is stored in /etc/timezone (which is often a symbolic link to the timezone data file specific to the timezone)....
Read more >
How to Check and Set Timezone in Ubuntu 20.04 - Serverlab
Checking Your Current Timezone​​ Another method is to use the date command. By giving it the argument +%Z , you can output your...
Read more >
How to Check Timezone in Linux - GeeksforGeeks
Method 1: Using the command “timedatectl”. We can use the timedatectl command to display the timezone along with other information. We can check ......
Read more >
Working with Time Zones - W3C
A time zone is a set of rules for determining the local observed time (wall time) as it relates to incremental time (as...
Read more >
Get Local Time Zone - Discussions on Python.org
As far as I know, to the extent that it is possible to accurately get the IANA zone from the system configuration, tzlocal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found