[solved] Time synchronization not correct (RTC / timezone)

Hello my dears,
my time synchronization is not running correctly on an OpenWrt router. On my second OpenWrt router everything is correct. Both configurations are identical. The 1 router has a time deviation of -1 hour. Here are the router configurations:
Router 1

# uci show system
...
system.@system[0].zonename='Europe/Berlin'
system.@system[0].timezone='CET-1CEST,M3.5.0,M10.5.0/3'
system.ntp=timeserver
system.ntp.enabled='1'
system.ntp.server='dsme01.intern.example.com' '1.openwrt.pool.ntp.org' '2.openwrt.pool.ntp.org' '3.openwrt.pool.ntp.org'
...
# cat /etc/TZ
CET-1CEST,M3.5.0,M10.5.0/3
# date
Sun Jan  6 22:54:47 UTC 2019
# ps | grep ntp
4675 root     14820 S    /usr/sbin/ntpclient -i 600 -s -l -D -p 123 -h dsme01.intern.example.com
 5822 root     16536 S<   /usr/sbin/ntpd -n -N -S /usr/sbin/ntpd-hotplug -p dsme01.intern.example.com -p 1.openwrt.pool.ntp.org -p 2.openwrt.pool.ntp
 5982 root     14464 S    grep ntp

Router 2

# uci show system
...
system.@system[0].zonename='Europe/Berlin'
system.@system[0].timezone='CET-1CEST,M3.5.0,M10.5.0/3'
system.ntp=timeserver
system.ntp.enabled='1'
system.ntp.server='dsme01.intern.example.com' '1.openwrt.pool.ntp.org' '2.openwrt.pool.ntp.org' '3.openwrt.pool.ntp.org'
...
# cat /etc/TZ
CET-1CEST,M3.5.0,M10.5.0/3
# date
Sun Jan  6 23:54:40 CET 2019
# ps | grep ntp
1485 root       912 S    /usr/sbin/ntpclient -i 600 -s -l -D -p 123 -h dsme01.intern.example.com
 1881 root      1200 S<   /usr/sbin/ntpd -n -N -S /usr/sbin/ntpd-hotplug -p dsme01.intern.example.com -p 1.openwrt.pool.ntp.org -p 2.openwrt.pool.ntp
 2029 root      1200 S    grep ntp

Why is the time on Router 1 incorrect? Why does the date command display "UTC"?

Support is requested

Greetings from Stefan Harbich

The time is correct. The problem is the presentation. In R1 you have UTC and in R2 you have CET. CET is UTC+1, hence the difference.
Try date -k or R1

This solution does not fix the problem

root@rome01:~# date -k
root@rome01:~# date
Mon Jan  7 00:22:40 UTC 2019
The current Time ist 01:22:40

date -R1 not running
How can I switch from "UTC" to "CET"?

Go to Luci, system > system and select your time zone

If you had read the first post, then you would have seen that the time zone of both routers are correct. This proposal has not brought a solution. See image.
Unbenannt

Do I have to be in the kernel_menuconfig a clock source timer?

Do you have the same version of date on each device?

remove dsme01.intern.example.com from the serverslist, reboot, and see if the problem persists

My understanding is that the kernel always keeps time as UTC, then user space functions modify it to local time. In both routers the kernel's UTC is correct.

Though this is somewhat a cop-out to your problems with getting local time, I will point out that it is traditional and pragmatic to set network devices and servers to UTC.

1 Like

Have you rebooted R2 or did /etc/init.d/system reload since making those settings?

1 Like

If none of these work, try to switch to another timezone (preferably the UTC), check the date, then switch back to CET/Berlin and recheck.

The Router 1 is a APU1D4 with Hardware Clock. Version OpenWrt 18.06-SNAPSHOT r7407-1cd945ea22
The Router 2 is a TP-Link Archer C7 v2. Version LEDE Reboot SNAPSHOT r5327-e2f25e6

I changed the name. There is my internal NTP server in it.

I have reboot the Router.

I have already made. Has not brought success.

How about upgrading R2 to 18.06?

Since the router 2 synchronized the time properly, I'm still waiting with the update until I found the problem on the router 1. Only then I create the new firmware version 18.06.

when you run "date --version" what do you get on the two ? (yes I know the busybox date doesn't have a --version but it does output info about itself if you give it invalid options :wink: )

If I put all routers and servers on UTC then the local time is not correct any more and I get many synchronization problems (OpenLDAP, MariaDB, (DNS & DHCP runs also in the OpenLDAP)). This really is not a good approach.

I think it is related to my hardware clock on the router 1 of the APU1D4 board. I am currently compiling hwclock and RTC support for the kernel. Mak, see if that helps. I think my hardware clock on the board is wrong.

  • It isn't true that you will have sync issues. Computers are smart enough to know what time zone is being used. In fact, NTP time is given in UTC.

  • Even if your hardware clock is wrong, you should be getting the same time upon sync. In any case, fix your hardware clock.

  • Can you at least verify the correct time is displayed if you set R2 to UTC?