LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   System clock is not synchronized (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/system-clock-is-not-synchronized-4175664107/)

ChangaManga 11-12-2019 09:23 AM

System clock is not synchronized
 
Hi.
I have a embedded system running linux.
For some reason the system clock is not synchronised, it's running fast, every 45 seconds in the system clock is actually 60 seconds in the real world.

there is another strange thing, if I stop the system in the U-Boot and check the time there its working fine, synchronised and progress well.

I've checked the DTS file, cant find anything wrong there.

What can be the issue?

Thank you.

camorri 11-12-2019 09:54 AM

Haven't got a clew what a DTS file is in linux.

Normally you edit a /etc/ntp.conf file and set time from a government time server. There area lot of How To's online, search 'linux ntp.conf' or 'linux date'.

A clock running wild sounds more like a hardware issue. Any clock will drift a second or two, what you describes in not a simple drift.

It would help if you told us what hardware you are using, and what linux version and release. Without this basic info, we can not help more.

ChangaManga 11-12-2019 09:57 AM

Hi.
The device running the linux is not connected to the WEB, therefore it's not possible to sync the clock using NTP server.
The device has a very reliable clock in the HW, it's not accurate like NTP but it's far better then running 33% faster then real time clock.

camorri 11-12-2019 10:01 AM

If you have another system that has internet connectivity, and does sync to a real time clock, you can use it as a server, your bedded system can be a client.

You need to provide better info on hardware and software.

michaelk 11-12-2019 10:16 AM

You might be able to adjtimex to determine/adjust for the system clock drift rate and use hwclock via chron to sync the system clock to the hardware clock at a set interval.

https://linux.die.net/man/8/adjtimex
http://tldp.org/HOWTO/Clock-2.html

ChangaManga 11-12-2019 11:06 AM

My mistake the clock is running too slow not too fast. every 45Sec in the system clock it's actually 60Sec in real world time.

I don't think that the term "Drift" is best describe my situation.
The clock is running 25% slower then actual time, but his speed remain pretty constant.
Do you have any idea why in the Uboot the clock behave normal and in the linux it's start to run too slow?

I've tried to use adjtimex to adjust the time, for some reason it cause segmentation fault.

regarding adjusting it with cron from time to time, this will solve the small drift that every clock has, I will do it, but I first want to understand why its running so much slower at the beginning.

PECONET009 11-12-2019 11:26 AM

This might help you with your problem clock.
 
Quote:

Originally Posted by ChangaManga (Post 6056786)
Hi.
I have a embedded system running linux.
For some reason the system clock is not synchronised, it's running fast, every 45 seconds in the system clock is actually 60 seconds in the real world.

there is another strange thing, if I stop the system in the U-Boot and check the time there its working fine, synchronised and progress well.

I've checked the DTS file, cant find anything wrong there.

What can be the issue?

Thank you.

This might help you; https://www.digi.com/resources/docum...s/90000852.pdf


All times are GMT -5. The time now is 05:06 AM.