I have no ideas how to fix this. In my /etc/TIMEZONE file the TZ variable has the correct value (Canada/Eastern) and still it's showing a -1 hour lag. Where else should I be looking?
You should check what your hardware clock is.
I would suggest doing this:
Set the UTC time correctly. i.e. (5 AM in the example):
$ date -u -s "05:00"
Thursday, April 29, 2010 05:00:00 AM UTC
Set the hardware clock accordingly (tod for SPARC and rtc for x86):
$ rtc -c (the '-c' argument sets the DST correctly)
Check the date again:
$ date
Thursday, April 29, 2010 02:00:11 AM ART
Regards,
Leandro.
Is your machine patched up-to-date? There were changes in DST handling for North America in 2007. On my Solaris 10 I have:
-bash-3.00$ ls -l /usr/share/lib/zoneinfo/Canada/Eastern
-rw-r--r-- 2 root bin 1252 Jul 14 2008 /usr/share/lib/zoneinfo/Canada/Eastern
-bash-3.00$ openssl md5 /usr/share/lib/zoneinfo/Canada/Eastern
MD5(/usr/share/lib/zoneinfo/Canada/Eastern)= 82980b1345aab5a97d90307edfefb6da
Do you use NTP to set the time automatically or do you do it manually?
Volker
When you actually log into the host, what timezone is set in your shell session?
If the timezone in your shell session doesn't match /etc/TIMEZONE, then you probably need to reboot for the timezone change to take effect.
If the timezone in your shell session is correct, but the actual time is wrong, then either the system clock is off or the timezone definition file is wrong somehow. You can run "date -u" to get the UTC time, which will help you figure out if the actual clock is wrong.
That is the correct file to edit. The only other step required is a reboot. The reason a reboot is required is that the init process reads the value of TZ when it is started, and all other processes inherit this value. As far as I know, there is no way to make the change effective without doing a full reboot.
Also, make sure /etc/TIMEZONE is symlinked to /etc/default/init. For example:
[root#server:/etc]ls -l /etc/ | grep TIMEZONE
lrwxrwxrwx 1 root root 14 Jul 7 2008 TIMEZONE -> ./default/init
Related
My raspi knows when EDT (Eastern US Daylight Time) is active,
HypriotOS/armv7: pirate#black-pearl in ~
$ date
Thu Oct 17 10:27:27 EDT 2019
the docker container for homeassistant knows when EDT is active,
root#black-pearl:/# date
Thu Oct 17 10:28:54 EDT 2019
but I cannot manage to get homeassistant v.0.100.2 to reflect this.
I've used
time_zone: EST
which does display the correct time if I were NOT in daylight savings.
Here's what else Ive tried:
passing in the hosts time, which clearly works as evidenced by the docker containers console
-v /etc/localtime:/etc/localtime
-v /etc/timezone:/etc/timezone:ro
Leaving blank in the hopes that freegeoip will solve this for me.
Using time_zone: EDT instead of EST but it isn't recognized as a valid config.
Ultimately I'm not above lying to hass and telling it we're in America/Moncton (UTC - 4) and manually switching it back to EST (UTC - 5) the night before our transitions, but thats not really in the spirit of automation so I'd rather not.
Any help?
America/New_York
SOLVED
this worked. im a dingus. if i knew how to read and FOLLOW DIRECTIONS i would have read to use tz_database_name instead of its common abbreviation.
credit to reddits u/kb5zuy
Today I noticed my cygwin shell is showing the wrong time. It is actually UTC time while it is supposed to be my local time. As soon as I unset the TZ variable it shows the local time.
Here are some commands which show the situation.
I am running windows 10. My windows has UTC-5:00 timezone and its time is OK.I do not remember when did it start to be like this but my colleagues computers are fine. Has anyone seen this before ?
$ date
Mon, Oct 31, 2016 9:13:38 PM
$ date --utc
Mon, Oct 31, 2016 9:13:42 PM
$ echo $TZ
America/Toronto
$ unset TZ
$ date
Mon, Oct 31, 2016 5:13:56 PM
$ cygcheck.exe -V
cygcheck (cygwin) 2.6.0
System Checker for Cygwin
Copyright (C) 1998 - 2016 Cygwin Authors
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
As you might already know, Cygwin sets the timezone in this file :
$ tail -1 /etc/profile.d/tzset.sh
test -z "$TZ" && export TZ=$(/usr/bin/tzset)
Thanks to matzeri that pointed out my tzdata, I tried to reinstall tzdata and saw an error about cygintl-8.dll. I searched for that package in Cygwin web site and fount it there:
libintl8-0.19.8.1-2 - libintl8: GNU Internationalization runtime library (installed binaries and support files)
reinstalled the package and problem is resolved.
The Turkish government decided to stay at the EEST (GMT+3) timezone (daylight saving timezone) from now on; the timezone will be fixed to GMT+3 from now on in Turkey. Is there going to be an update for the timezone file for Linux systems due to this change? When is it going to be published?
As long as it has been decided to stay in current timezone, you can use GMT+3 until getting any update from Turkish officials.
sudo unlink /etc/localtime
sudo ln -s /usr/share/zoneinfo/Etc/GMT+3 /etc/localtime
Good luck!
Looks like for vmware no need to play on it , its default UTC
Related article
https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2135594
Don't use +3 because zones like Etc/GMT+6 are intentionally reversed for backwards compatibility with POSIX standards.
Instead of +3 use below;
sudo unlink /etc/localtime
sudo ln -s /usr/share/zoneinfo/Etc/GMT-3 /etc/localtime
Otherwise you will have the reversed and will have 6 hours difference.
I'm a new user of GCE instances.
I created instances a week ago and changed timezone to Asia/Shanghai by commands below:
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
Then yesterday, I found that my system timezone changed to UTC automatically and /etc/localtime was changed. So I run the command above agina. Until now it's OK.
After that I checked many resources and export TZ='Asia/Shanghai'. But I still not know if it's the root cause or not.
Also I find that someone adds xen.independent_wallclock=1 in sysctl.conf file to maintain independent times. But it's for Xen VM and I'm not sure if it's useful for GCE.
Could anyone please take a look at it ?
I've found a more user friendly approach here
Go root user
sudo -s
and use
dpkg-reconfigure tzdata
This will bring up a GUI which will guide you to change your timezone information
To make the permanent change edit $HOME/.profile or $HOME/.bash_profile appending the line and then log out and log in again:
TZ='Asia/Shanghai'; export TZ
for windows users open powershell as admin and type TZUtil.exe /s "<your new time zone>".
to see a list of all available time zones type TZUtil.exe /l.
for more info type TZUtil.exe /?.
I changed the time zone of my server (Ubuntu 12.04) to UTC via:
echo 'UTC' > /etc/timezone
dpkg-reconfigure --frontend noninteractive tzdata
When running date, I can see the time is now in UTC.
However, on /var/log/syslog, it still displays the time with the previous setup timezone and not UTC. Why ?
How to make it take effect on the whole system? Reboot?
Thanks.
To have the syslog daemon pick up the new time zone, use the command:
sudo service rsyslog restart
I found the name of the service to restart with:
ls /etc/init.d/*log*
In general you will have to restart every process on the system that you want to see the new timezone. If there’s only one or two, like syslog, that you care about, then you can restart them individually, but you’re probably better off rebooting and getting everything consistent.
To switch to UTC, simply execute sudo dpkg-reconfigure tzdata, scroll to the bottom of the Continents list and select Etc; in the second list, select UTC. If you prefer GMT instead of UTC, it's just above UTC in that list.