5

I have an embedded computer running Ubuntu Server 14.04 that has no CMOS battery (temporary, I hope) so it always boots to December 31, 2008 ... Currently I'm developing an application that depends on some installed hardware. I start Gnome from the command line to get a GUI for development.

When running in production mode it will not have an internet connection (or display etc.) but will have a GPS referenced NTS device on the local LAN.

When I started the machine this morning the internet connection was out so the files are way out of synch. Is there software utility that 'fakes' saving time so that successive boots will have reasonable, and increasing times?

degenerate
  • 456
  • 5
  • 22

2 Answers2

3

If you can access the GPS output, each 1 second location update contains the current UTC time. To decode the time, here is a document detailing each gps sentence syntax.

jdh
  • 7,140
1

You want the fake-hwclock package. Description from the Debian package page:

fake-hwclock: Save/restore system clock on machines without working RTC hardware

Some machines don't have a working realtime clock (RTC) unit, or no driver for the hardware that does exist. fake-hwclock is a simple set of scripts to save the kernel's current clock periodically (including at shutdown) and restore it at boot so that the system clock keeps at least close to realtime. This will stop some of the problems that may be caused by a system believing it has travelled in time back to 1970, such as needing to perform filesystem checks at every boot.

On top of this, use of NTP is still recommended to deal with the fake clock "drifting" while the hardware is halted or rebooting.

dfc
  • 757
  • 6
  • 11