element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Blog Time Drift on an OpenELEC Pi 2
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
GPIO Pinout
Raspberry Pi Wishlist
Comparison Chart
Quiz
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Former Member
  • Date Created: 6 Apr 2015 5:57 PM Date Created
  • Views 548 views
  • Likes 1 like
  • Comments 1 comment
Related
Recommended
  • pi
  • openelec
  • ntp
  • raspberry-pi
  • raspberry_pi_space
  • time

Time Drift on an OpenELEC Pi 2

Former Member
Former Member
6 Apr 2015

OpenELEC is a special Linux distribution because it runs a single specialized application: Kodi.  As a consequence of being understandably cautious, there are limitations to what a user can do in terms of administration in this environment.

 

For example, many of the Debian Linux utilities found in Raspbian are not present in OpenELEC.  Examples include the `dpkg*` and `apt*` families for system update and maintenance.  I don't mind those limitations at all.  However, one irksome situation concerns time synchronization.  While the user has full ability to configure the local time zone, we seem to have been left to our own devices for setting and updating the clock time.  Note that `ntpd` (network time protocol daemon) is installed but it is not configured nor started - at least in Raspberry Pi OpenELEC version 5.0.8.

 

So, I just finished a band-aid which will probably work for you if you are also observing time drift issues like I have (E.g. after powering off for a bit). Hopefully, at some time in the future, OpenELEC will include automatic periodic execution of `ntpd`.

 

1. ssh to the OpenELEC Pi 2 server as the root.  The remaining steps (2-7) take place in the ssh window.

 

2. Edit /storage/.config/autostart.sh with your favorite Linux text editor.  If you have never added anything to this file before, it will not yet exist.  Don't worry, just create it.

 

3. Append the following 2 lines to autostart.sh:

#!/bin/sh

(sleep 10; /sbin/ntpd -p pool.ntp.org; )&


The URL pool.ntp.org points to a global pool of time servers.  You can also address a continent-specific or country-specific pool of time servers.  See http://www.pool.ntp.org/zone/@ for details.


Do not use the -q command line option of `ntpd` or the daemon will execute once on OpenELEC startup and then quit (unless, of course, that is what you want). 


The sleep parameter of 10 seconds is a delay to allow networking to be established before trying to fetch network time.


4. Save and exit the editor.  If in doubt of your editing, cancel (E.g. `vi` :q!), exit, and go back to step 2.

 

5. Make sure that autostart.sh is executable:

chmod +x /storage/.config/autostart.sh

 

6. Test:

sh /storage/.config/autostart.sh

sleep 10; date

echo 'How does the time display look in the command line?'

 

7. When okay to do so, execute:

reboot

 

How does the time display look now on the GUI?

 

Afterthought: I would have thought that the contents of /storage/.config would have been under /etc where they usually are in Unix and Linux.  Also, an autostartup.sh would have been /etc/rc.local (Debian-sh) or some other "rc" mechanism.  Maybe the OpenELEC folks are trying to remind us that this distribution is different.  No worries.

  • Sign in to reply
  • clem57
    clem57 over 10 years ago

    Nice write up. Thanks

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube