Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] hwclock - activate local time  (Read 2521 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

[SOLVED] hwclock - activate local time

Hello,

I read this, but I don't understand what to do
https://forum.artixlinux.org/index.php/topic,1335.msg9312.html#msg9312
https://forum.artixlinux.org/index.php/topic,1311.0.html
https://forum.artixlinux.org/index.php/topic,1311.msg9306.html#msg9306
https://forum.artixlinux.org/index.php/topic,1311.msg9317.html#msg9317
https://github.com/karelzak/util-linux/commit/cd781c405be82540484da3bfe3d3f17a39b8eb5c
-------------------------------------

My clock in Bios show the real time. The Systemtime show 2 h later.
I have no MS-Windows installed. Dualboot with MX Linux.
On boot there is shown (with the right time 11:51)
/var/log/rc.log
Code: [Select]
rc default logging started at Mon Jun 14 11:51:26 2021
 * WARNING: clock skew detected!

After boot
Code: [Select]
xmg:[me]:~$ sudo hwclock --show
[sudo] Passwort für me:
2021-06-14 14:05:37.577224+02:00
xmg:[me]:~$ sudo hwclock --systohc
[sudo] Passwort für me:
xmg:[me]:~$


Here I found 2 options to use the Hardware clock. The kernel method I am afraid and not able to test.
https://wiki.gentoo.org/wiki/System_time#Hardware_clock
https://wiki.gentoo.org/wiki/System_time#OpenRC_2

Quote
Syncing the hardware clock and system time

Typically the hardware clock is used to setup the system clock on boot. This can be done by the kernel itself or by a boot service (init script). Also on shutdown the kernel or a service can write the software clock to the hardware clock. This aids the system in having the correct time on boot.
In-kernel method

OpenRC

When using OpenRC the hwclock init script can set the system clock on boot and sync system time to the hardware clock on shutdown. The service is enabled by default and should be disabled in favor of the above mentioned in-kernel method. The hwclock script should not be run when using the kernel's real time clock.


The original /etc/conf.d/hwclock (without comments)
Code: [Select]
clock="UTC"
#clock_hctosys="YES"
#clock_systohc="YES"
clock_args=""

1. Step set clock="local" -> reboot -> nothing changed
2. Step set
#clock="UTC"
clock_hctosys="YES"
clock_systohc="YES"

Code: [Select]
xmg:[me]:~$ sudo rc-service hwclock restart 
[sudo] Passwort für me:
hwclock           | * WARNING: you are stopping a boot service
hwclock           | * Setting hardware clock using the system clock [UTC] ...                 [ ok ]
hwclock           | * Setting system clock using the hardware clock [UTC] ...                 [ ok ]
xmg:[me]:~$ sudo rc-update add hwclock boot
 * rc-update: hwclock already installed in runlevel `boot'; skipping
xmg:[me]:~$

 -> reboot -> nothing change

Thx for help TM


CPU: AMD Ryzen 7 4800H
GPU: NVIDIA GeForce GTX 1650 Ti mobile
loaded: amdgpu,ati,modesetting,nouveau
Kernel: up to date
DM: Xfce

Re: hwclock - activate local time

Reply #1
1. Step set clock="local" -> reboot -> nothing changed
After you set clock="local" and then reboot, during the reboot, hwclock script stores the wrong time to you BIOS clock. You need to enter BIOS setup after that and correct the clock. You need to do this only once, after that everything should work fine (until you reinstall linux and change this option again).

Re: hwclock - activate local time

Reply #2
Thank you very much VictorBrand.

You made my day. I tryed to fix the problems many hours, and now the solution ist so simple. What a shame ;)
CPU: AMD Ryzen 7 4800H
GPU: NVIDIA GeForce GTX 1650 Ti mobile
loaded: amdgpu,ati,modesetting,nouveau
Kernel: up to date
DM: Xfce


Re: [solved] hwclock - activate local time

Reply #4
A little update.
I made some research an find out how to use the npd instead of local time.

So I guess, I dont' have to change the hw clock in Bios, when change the summertime in Europe.
This seems more comfortable.

I found in Gentoo Wiki, how to use this option. https://wiki.gentoo.org/wiki/OpenNTPD#OpenRC
I run:
Code: [Select]
sudo /etc/init.d/ntpd start
rc-update add ntpd default


CPU: AMD Ryzen 7 4800H
GPU: NVIDIA GeForce GTX 1650 Ti mobile
loaded: amdgpu,ati,modesetting,nouveau
Kernel: up to date
DM: Xfce