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.