CentOSThis forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
But it is impossible, it shows always 8 hours more as local time
[root@localhost ~]# timedatectl status Local time: Sun 2022-04-03 09:06:31 CEST Universal time: Sun 2022-04-03 07:06:31 UTC RTC time: Sun 2022-04-03 07:06:31 Time zone: Europe/Madrid (CEST, +0200) NTP enabled: yes NTP synchronized: no RTC in local TZ: no DST active: yes Last DST change: DST began at Sun 2022-03-27 01:59:59 CET Sun 2022-03-27 03:00:00 CEST Next DST change: DST ends (the clock jumps one hour backwards) at Sun 2022-10-30 02:59:59 CEST Sun 2022-10-30 02:00:00 CET
[root@localhost ~]# date date Sun Apr 3 09:06:32 CEST 2022
More importantly, what exactly do those commands return?
Please show us the commands themselves & all their output, in CODE tgas (see my signature).
Quote:
Originally Posted by SPiKeGoD
I have tried to fix the time with:
date -s "04/03/2022 01:06:31"
or
timedatectl set-time 01:06:31
But it is impossible, it shows always 8 hours more as local time
[root@localhost ~]# timedatectl status Local time: Sun 2022-04-03 09:06:31 CEST Universal time: Sun 2022-04-03 07:06:31 UTC RTC time: Sun 2022-04-03 07:06:31 Time zone: Europe/Madrid (CEST, +0200) NTP enabled: yes NTP synchronized: no RTC in local TZ: no DST active: yes Last DST change: DST began at Sun 2022-03-27 01:59:59 CET Sun 2022-03-27 03:00:00 CEST Next DST change: DST ends (the clock jumps one hour backwards) at Sun 2022-10-30 02:59:59 CEST Sun 2022-10-30 02:00:00 CET
[root@localhost ~]# date date Sun Apr 3 09:06:32 CEST 2022
More importantly, what exactly do those commands return?
Please show us the commands themselves & all their output, in CODE tgas (see my signature).
Code:
[root@localhost ~]# date -s "04/03/2022 13:04:31"
Sun Apr 3 13:04:31 CEST 2022
Code:
[root@localhost ~]# timedatectl set-time 13:05:30
Failed to set time: Automatic time synchronization is enabled
Code:
[root@localhost ~]# timedatectl
Local time: Sun 2022-04-03 21:05:15 CEST
Universal time: Sun 2022-04-03 19:05:15 UTC
RTC time: Sun 2022-04-03 19:04:55
Time zone: Europe/Madrid (CEST, +0200)
NTP enabled: yes
NTP synchronized: no
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2022-03-27 01:59:59 CET
Sun 2022-03-27 03:00:00 CEST
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2022-10-30 02:59:59 CEST
Sun 2022-10-30 02:00:00 CET
You have new mail in /var/spool/mail/root
The time on the BIOS had 6 more hours, i have changed the time to 13:16 (local time here, Spain), but the time now has 2 more hours:
Code:
[root@localhost ~]# timedatectl
Local time: Sun 2022-04-03 15:17:29 CEST
Universal time: Sun 2022-04-03 13:17:29 UTC
RTC time: Sun 2022-04-03 13:17:29
Time zone: Europe/Madrid (CEST, +0200)
NTP enabled: yes
NTP synchronized: no
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2022-03-27 01:59:59 CET
Sun 2022-03-27 03:00:00 CEST
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2022-10-30 02:59:59 CEST
Sun 2022-10-30 02:00:00 CET
Code:
[root@localhost ~]# date
Sun Apr 3 15:18:58 CEST 2022
[root@localhost ~]# date
Mon Apr 4 20:31:30 CEST 2022
[root@localhost ~]# timedatectl
Local time: Mon 2022-04-04 20:31:34 CEST
Universal time: Mon 2022-04-04 18:31:34 UTC
RTC time: Mon 2022-04-04 11:31:43
Time zone: Europe/Madrid (CEST, +0200)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2022-03-27 01:59:59 CET
Sun 2022-03-27 03:00:00 CEST
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2022-10-30 02:59:59 CEST
Sun 2022-10-30 02:00:00 CET
[root@localhost ~]#
The time is OK on hwclock but it's wrong on timedatectl and date
Most systems have two clocks i.e. the hardware/BIOS clock and the system clock.
The hardware clock is only used at boot time to sync the system clock. It is a simple integrated circuit clock without any reference. Its either set to local or UTC time and the reference configured in the /etc/adjtime file. The timedatectl shows the reference as RTC in local TZ: yes or no. Since your system is no the hardware clock should be set to UTC.
The system clock is basically a counter that gets incremented by some timer. Its reference is always UTC with zero being 00:00:00 UTC, 1 January 1970.
The timezone setting is used to show the date in local time although many desktops have their own timezone setting.
There are several time sync clients and CentOS uses chrony by default.
Most systems have two clocks i.e. the hardware/BIOS clock and the system clock.
The hardware clock is only used at boot time to sync the system clock. It is a simple integrated circuit clock without any reference. Its either set to local or UTC time and the reference configured in the /etc/adjtime file. The timedatectl shows the reference as RTC in local TZ: yes or no. Since your system is no the hardware clock should be set to UTC.
The system clock is basically a counter that gets incremented by some timer. Its reference is always UTC with zero being 00:00:00 UTC, 1 January 1970.
The timezone setting is used to show the date in local time although many desktops have their own timezone setting.
There are several time sync clients and CentOS uses chrony by default.
systemctl status chronyd
To see how it well it is working
chronyc sources
First of all, thank you very much for answering my post!
MS Name/IP address Stratum Poll Reach LastRx Last sample
^* 185.179.104.7 1 6 377 40 +696us[+1972us] +/- 15ms
This is the server you are currently synced to presently. Does the date command show the correct local time?
No, my local time (Europe/Madrid) is 17:15. The server has other time
Code:
Tue Apr 5 00:08:20 CEST 2022
[root@localhost ~]# date
Tue Apr 5 00:14:43 CEST 2022
[root@localhost ~]# timedatectl
Local time: Tue 2022-04-05 00:14:45 CEST
Universal time: Mon 2022-04-04 22:14:45 UTC
RTC time: Mon 2022-04-04 15:15:43
Time zone: Europe/Madrid (CEST, +0200)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2022-03-27 01:59:59 CET
Sun 2022-03-27 03:00:00 CEST
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2022-10-30 02:59:59 CEST
Sun 2022-10-30 02:00:00 CET
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.