Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
UTC not working as it should on one of my machines...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
vcmota
Guru
Guru


Joined: 19 Jun 2017
Posts: 367

PostPosted: Thu Mar 14, 2019 12:52 pm    Post subject: UTC not working as it should on one of my machines... Reply with quote

Yesterday I configured system time in one of my machines using UTC. As described in the wiki here and here, I followed those steps:

Code:

root #echo "UTC" > /etc/timezone
root #emerge --config sys-libs/timezone-data


and everything worked flawlessly, the time was set accurately. But today I followed the same procedure in another one of my machines and it just does not work. No error messages whatsoever but I am not getting the correct time. Right now in my timezone is 9:16AM (according to my android phone) but the computer was set to 12:12PM. The only thing I can think of that makes those two machines distinct is that in the machine where the error occurs my /etc/resolv.conf has been set to the servers of my VPN, which are certainly located abroad. Could that be the reason?
Thank you all.
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Thu Mar 14, 2019 2:00 pm    Post subject: Reply with quote

Please post the output of
Code:
1) hwclock
2) date
3) date --utc
4) export | grep TZ
5) cat /etc/timezone
6) ntpq -p        # if you use ntp
7) timedatectl    # if you use Systemd

Do you use Systemd or OpenRC?
Back to top
View user's profile Send private message
vcmota
Guru
Guru


Joined: 19 Jun 2017
Posts: 367

PostPosted: Thu Mar 14, 2019 5:46 pm    Post subject: Reply with quote

Thank you mike155 for your reply. Here it goes:

Code:

~> sudo hwclock
2019-03-14 17:40:12.166973+00:00
~> sudo date
Thu Mar 14 17:40:16 UTC 2019
~> sudo date --utc
Thu Mar 14 17:40:25 UTC 2019
~> export | grep TZ
~> cat /etc/timezone
UTC
~>



I use OpenRC and I dont use ntp. Thank you again!
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Thu Mar 14, 2019 11:32 pm    Post subject: Reply with quote

vcmota, thanks for your answer.

First of all: I've never heard that Name service interferes with time/date settings. I think you can rule that out.

I looked at the output you posted - and I'm afraid I don't understand the problem:
  1. "date --utc" seems to show the correct date in UTC, right?

  2. 'date' shows the same output as 'date --utc'.

    In which local time zone do you live?

    If your local time zone is UTC, everything is fine. If you live in a different time zone, you must configure your time zone. Please read https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Base#Timezone and fix that. 'date' must show the date in local time.

  3. hwlock also seems to give you the correct date in UTC. That doesn't look wrong...
Please explain what you think is wrong.
Back to top
View user's profile Send private message
vcmota
Guru
Guru


Joined: 19 Jun 2017
Posts: 367

PostPosted: Fri Mar 15, 2019 2:37 am    Post subject: Reply with quote

Thank you mike for your reply!

You are correct: all options shows the same time. However, the time at that moment was three hours and some minutes earlier. It wasn't even an integer multiple of an hour, which was very weird. Is it possible that at that machine for some reason UTC was getting the wrong time? By the way, I have followed all the steps on the link you have sent , and in another machine (in fact the one I am typing from right now) it worked flawlessly, showing the correct UTC time at that moment.

Thank you again for your reply.
Back to top
View user's profile Send private message
guitou
Guru
Guru


Joined: 02 Oct 2003
Posts: 534
Location: France

PostPosted: Fri Mar 15, 2019 2:06 pm    Post subject: Reply with quote

Hello.

If you do not use ntp, it is up to you to adjust date and time by hand. Depending on your settings, date adjustment from system may or may not persist after a reboot, then it may be simpler to set this in BIOS.
Anyway, unless your computer is never (or almost) online, I would recommend you to use ntp to keep date accurate: hardware clocks are not reliable.

++
Gi)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum