LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 11-12-2019, 10:23 AM   #1
ChangaManga
LQ Newbie
 
Registered: Nov 2019
Posts: 3

Rep: Reputation: Disabled
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.
 
Old 11-12-2019, 10:54 AM   #2
camorri
LQ Veteran
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1, 14.2, current, slackware-arm-currnet
Posts: 5,438

Rep: Reputation: 621Reputation: 621Reputation: 621Reputation: 621Reputation: 621Reputation: 621
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.
 
Old 11-12-2019, 10:57 AM   #3
ChangaManga
LQ Newbie
 
Registered: Nov 2019
Posts: 3

Original Poster
Rep: Reputation: Disabled
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.
 
Old 11-12-2019, 11:01 AM   #4
camorri
LQ Veteran
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1, 14.2, current, slackware-arm-currnet
Posts: 5,438

Rep: Reputation: 621Reputation: 621Reputation: 621Reputation: 621Reputation: 621Reputation: 621
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.
 
Old 11-12-2019, 11:16 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,215

Rep: Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993
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
 
Old 11-12-2019, 12:06 PM   #6
ChangaManga
LQ Newbie
 
Registered: Nov 2019
Posts: 3

Original Poster
Rep: Reputation: Disabled
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.

Last edited by ChangaManga; 11-12-2019 at 12:21 PM.
 
Old 11-12-2019, 12:26 PM   #7
PECONET009
Member
 
Registered: Sep 2006
Location: Finland.
Distribution: kali linux.
Posts: 145

Rep: Reputation: 19
This might help you with your problem clock.

Quote:
Originally Posted by ChangaManga View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bind dns master and slave are not synchronized immediately hilou Linux - Server 7 04-06-2016 06:29 AM
[SOLVED] ntpd not synchronized rbeserie Linux - Networking 24 03-31-2011 11:56 AM
System clock correct, hardware clock wrong karlovac Linux - General 5 01-16-2009 08:19 PM
Desktop clock not synced with system clock greenphreak Debian 5 08-22-2007 02:32 PM
system clock vs. CMOS clock dtamajka Linux - General 7 12-11-2003 06:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 02:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration