You are not logged in.
I found some threads regarding this problem. This - https://forum.xfce.org/viewtopic.php?id=8741 , and especially this - https://bbs.archlinux.org/viewtopic.php?id=166779 (has the same title as mine). But I couldn't a) Understand the solutions. b) Their problems are slightly different than mine.
So I want the time to be displayed as the time of Asia/Kolkata (IST, +530) timezone. However, my UTC time is being displayed as localtime. It is the correct time, that of the Asia/Kolkata timezone. But then localtime becomes +530 from the localtime (as UTC is set as localtime for some reason, and localtime is UTC +530) so it is off by 5 hours, 30 minutes.
Here are the outputs of some commands I think are relevant.
[dds@raf ~]$ timedatectl status
Local time: Sat 2018-01-27 01:21:17 IST
Universal time: Fri 2018-01-26 19:51:17 UTC
RTC time: Fri 2018-01-26 19:51:17
Time zone: Asia/Kolkata (IST, +0530)
System clock synchronized: no
systemd-timesyncd.service active: no
RTC in local TZ: no[dds@raf ~]$ sudo hwclock
[sudo] password for dds:
2018-01-27 01:22:20.671041+0530
[dds@raf ~]$ [dds@raf ~]$ date
Sat Jan 27 01:22:47 IST 2018
[dds@raf ~]$ So it can be seen that hwclock and date commands are showing the _incorrect_ localtime, which is actually the incorrect UTC (set to correct localtime) +530 and therefore the correct localtime is only displayed as the UTC.
Please let me know what I can do to fix the problem. I have tried the following commands -
sudo rm /etc/localtime
sudo ln -sr /usr/share/zoneinfo/America/Phoenix /etc/localtimebut they didn't work. Please let me know which commands to run. I dual boot with windows and am aware of an error with time that windows done (forgetting what it was at the moment) but I promise to not boot into windows until this problem is fixed. I am only using archlinux exclusively. Please provide any help you can and ask for any logs/outputs of commands. Thank you. I am very new to archlinux so I may ask some very beginner questions.
Last edited by shera10001 (2018-01-26 16:54:42)
Offline
Your system is configured to take the RTC as UTC while it's obviously set in IST.
Either fix the RTC, configure the system to read the RTC as local time and/or setup time sync (ntp) - https://wiki.archlinux.org/index.php/Time
Edit: UTC is close to / based on Greenwich/London (GMT) - nobody gives a shit about Arizona :-P
Last edited by seth (2018-01-26 14:41:43)
Offline
So should I fix the RTC through the BIOS or follow this from the archwiki on Time -
To change the hardware clock time standard to localtime, use:
# timedatectl set-local-rtc 1
To revert to the hardware clock being in UTC, type:
# timedatectl set-local-rtc 0
If so, which one of them should I choose, should my RTC be in localtime or UTC? I had already done -
hwclock --systohc --utc during installation but still this problem is occuring. Is it something to be done in the BIOS?
EDIT : Using set-local-rtc 1 gives the message - "Warning: The system is configured to read the RTC time in the local time zone.
This mode can not be fully supported. It will create various problems
with time zone changes and daylight saving time adjustments. The RTC
time is never updated, it relies on external facilities to maintain it.
If at all possible, use RTC in UTC by calling
'timedatectl set-local-rtc 0'.
" So it is not recommended. But setting it to 0 doesn't make any change. My UTC is still equal to localtime, and then localtime is ofcourse off by +530 from the incorrect UTC (which is displaying the correct localtime).
Last edited by shera10001 (2018-01-26 15:55:18)
Offline
do I want my RTC to be in localtime or UTC?
How is anyone here supposed to know what *you* want??
Think for yourself, make up your mind and when you struggle to implement it, ask back.
If you want to be told what you want, you're using the wrong distro.
Offline
Maybe this helps with a decision: https://wiki.archlinux.org/index.php/Du … e_standard
Last edited by V1del (2018-01-26 15:50:49)
Offline
do I want my RTC to be in localtime or UTC?
How is anyone here supposed to know what *you* want??
Think for yourself, make up your mind and when you struggle to implement it, ask back.If you want to be told what you want, you're using the wrong distro.
That was poorly phrased, sorry about that. In fact I edited my post to say "should my RTC be in localtime or UTC?" Also, because of the warning I now know that it should be set to UTC. But even using hwclock --systohc --utc and # timedatectl set-local-rtc 0 there is no change. Please tell me what else should I try.
Offline
First of all, ensure your timezone is set correctly.
Then set the correct system time, "Local time" and "Universal time" should show the proper times.
As you figured, running the RTC in localtime mode is not the best idea ever, so ensure you're not.
Finally sync the rtc with the system time.
Ultimately be prepared that Windows might still screw around with the RTC (you have to make sure it treats it as UTC)
And consider running a time syncing daemon, whether systemd-timesyncd or ntp doesn't matter (except I'm wlling to bet that systemd-timesyncd has more bugs ;-)
Offline
First of all, ensure your timezone is set correctly.
Then set the correct system time, "Local time" and "Universal time" should show the proper times.
As you figured, running the RTC in localtime mode is not the best idea ever, so ensure you're not.
Finally sync the rtc with the system time.Ultimately be prepared that Windows might still screw around with the RTC (you have to make sure it treats it as UTC)
And consider running a time syncing daemon, whether systemd-timesyncd or ntp doesn't matter (except I'm wlling to bet that systemd-timesyncd has more bugs ;-)
Timezone is set correctly, verified it with
timedatectl statuscommand.
Set the correct time for local time with
# timedatectl set-time "yyyy-MM-dd hh:mm:ss"Ensured RTC is not in local time by running the command
# timedatectl set-local-rtc 0- Also did
hwclock --systohc --utcfor ensuring above. This also did the step after that you recommended, which was to sync the RTC with the system time.
This has produced the following (correct output) -
[dds@raf ~]$ timedatectl status
Local time: Fri 2018-01-26 21:53:40 IST
Universal time: Fri 2018-01-26 16:23:40 UTC
RTC time: Fri 2018-01-26 16:23:40
Time zone: Asia/Kolkata (IST, +0530)
System clock synchronized: no
systemd-timesyncd.service active: no
RTC in local TZ: noSo as can be seen, local time is correct according to the timezone (verified personally through use of other clocks), and the UTC time is 0530 hours behind that. Hence, the system has properly set both the UTC time and the localtime according to the timezone. Also, RTC is not in local TZ as can be seen from the last line of the code.
But on running
sudo hwclock --show it still shows the time to be in localtime.
[dds@raf ~]$ sudo hwclock --show
2018-01-26 21:54:09.827333+0530Shouldn't it be displaying the UTC/Universal time now? In fact, it it showing the error again, as in it is again showing the UTC set as localtime, and then the 'interpreted' or localtime according to timezone to be +0530 hours. I would mark this thread as solved, as my system time has been corrected, but the hardware clock, or RTC is still set to localtime (or the strange UTC set to be equal to localtime) + timezone hours.
EDIT : manpage for hwclock says, for the --utc option - "If you specify neither --utc nor --localtime then the one last
given with a set function (--set, --systohc, or --adjust), as
recorded in /etc/adjtime, will be used. If the adjtime file
doesn't exist, the default is UTC.". So I have specified --utc but still the localtime is being set it seems. Because the system time is correct now, 21:54 is the localtime, and Universal Time is -timezone hours behind it.
EDIT : checked the BIOS time, it is what RTC means I think. So it shows the UTC time now, so it was just a matter of rebooting the system. The output of
[dds@raf ~]$ timedatectl statusis also correct. Here -
[dds@raf ~]$ timedatectl status
Local time: Fri 2018-01-26 22:09:56 IST
Universal time: Fri 2018-01-26 16:39:56 UTC
RTC time: Fri 2018-01-26 16:39:56
Time zone: Asia/Kolkata (IST, +0530)
System clock synchronized: no
systemd-timesyncd.service active: no
RTC in local TZ: noHowever hwclock still outputs the localtime and then a +timezone hours. Output -
[dds@raf ~]$ sudo hwclock --show
[sudo] password for dds:
2018-01-26 22:08:41.999375+0530So this appears to be a problem with the hwclock command itself, since the BIOS is showing UTC time, and timedatectl status also shows RTC time in UTC time. So why would hwclock in the commandline output UTC time as local time and then +timezone hours (which presumably means it is showing UTC time (incorrectly equal to localtime))? Should I mark this thread as solved and start a new one based on the hwclock command output error?
Last edited by shera10001 (2018-01-26 16:44:25)
Offline
No, it's all fine.
The output says it's 21:54, including a 5:30 shift because of the timezone.
Try eg.
TZ=UTC hwclock --showOffline
No, it's all fine.
The output says it's 21:54, including a 5:30 shift because of the timezone.Try eg.
TZ=UTC hwclock --show
But isn't that giving false information to the command? I think hwclock should show the UTC time by default if I have already run
hwclock --systohc --utc(as it does in the BIOS menu). Why temporarily set the TZ to UTC when it is in reality Asia/Kolkata? And yes, if I do that then the output is correctly given as the UTC time. But RTC should by default, even with TZ=Asia/Kolkata give UTC time right? Or am I misunderstanding hwclock?
Offline
-r, --show
Read the Hardware Clock and print the time on Standard Output. The time shown is always in local time, even if you keep your Hardware Clock in Coordinated Universal Time. See the --utc option.
The RTC time in the timedatectl tells you what it is set to, you could now enable it's synchronization and then set up Windows so that it also respects your RTC in UTC as advised on the wiki.
Last edited by V1del (2018-01-26 16:51:47)
Offline
TZ=EST hwclock --showThe is merely an output thing. You're getting the time for your timezone. If you feel like the raw data should be printed by hwclock, file a bug upstream.
Offline
man hwclock wrote:-r, --show
Read the Hardware Clock and print the time on Standard Output. The time shown is always in local time, even if you keep your Hardware Clock in Coordinated Universal Time. See the --utc option.The RTC time in the timedatectl tells you what it is set to, you could now enable it's synchronization and then set up Windows so that it also respects your hwclock in UTC as advised on the wiki.
I have already done the sync through
hwclock --systohc --utcand the BIOS (which I think is the same thing as RTC) shows the time in UTC, so I think the synchronization part is done. I will setup windows as advised. Also the manpage quote explains why hwclock is showing localtime even though I have already set it to UTC. Thank you very much, all those who helped. I am marking the thread as solved. This community is great, if a bit brief at times.
Offline
The synchronization part is for making sure that the time stays correct even over long periods of time - https://wiki.archlinux.org/index.php/Time#Time_skew
Offline