Open alex3kov opened 9 years ago
As far as I know, only Cubieboard 3 (Cubietruck) has an RTC. There is a script /usr/sbin/cubian-ntpdate (if I remember right) that should sync your time to an NTP server. But you need Internet for that.
Thanks for feedback @EtlamGit cubian-ntpdate does nothing (cubie is connected to Internet):
root@Cubian:~# cubian-ntpdate
root@Cubian:~# echo $?
0
root@Cubian:~# date
Fri Jan 1 05:01:58 MSK 2010
Regarding RTC: there is a /dev/rtc0 file on the system, is this some sort of emulation? Strange thing is, hwclock
command works intermittently - sometimes hwclock -w
sets HW clock to software date/time, and sometimes it reports
root@Cubian:~# hwclock -w
hwclock: select() to /dev/rtc0 to wait for clock tick timed out: No such file or directory
root@Cubian:~# ls -l /dev/rtc0
crw------- 1 root root 254, 0 Jan 1 2010 /dev/rtc0
I think it should be at least explained in Cubian documentation.
In order to allow the time and date to recalibrate on every boot, install "ntpd" on to your system. Seems like ntpdate is depreciated as of September 2012.
http://askubuntu.com/questions/297560/ntpd-vs-ntpdate-pros-and-cons http://support.ntp.org/bin/view/Dev/DeprecatingNtpdate
Ever since I replaced ntpdate with ntpd, my system always recalibrate to the correct time on boot.
There is a bug (deadlock) in cubian-ntpdate when NTPD is installed: See last commit of: https://github.com/mmplayer/fsupdate/pull/1
So you have to change that script (or disable it completely) when NTPD is installed.
By the way: I would appreciate, if someone could help to improve that "NTPD is installed" check in the mentioned pull request.
On cubieboard 1 and 2 you can install fake-hwclock to approximate proper timekeeping.
On cubietruck, which has a real battery-backed hardware clock, you will still see this problem when you boot up without internet access. This is because the hwclock program (which is installed) is not configured to copy the hw clock time to the system time on boot (except in single user mode). You can fix this with the command
sudo update-rc.d hwclock 01 2
which will run hwclock soon after booting into normal mode.
I'm on Cubieboard1. On each boot, I get the same date of 2010:
I tried setting the date/time like this:
ntp is up and running. I'm not sure if Cubieboard1 has an actual HW clock. Is there a way to make date/time stick between reboots?