Many embedded devices do not have any way to keep time while they’re powered off. Doing so requires extra hardware, such as a battery, which might be too bulky or expensive or un-reliable to include. An embedded device without this hardware must synchronize its time with an external server every time it powers on or it will not know the correct time. In Linux, the Network Time Protocol (NTP) daemon (ntpd) can be used to synchronize the time. When an embedded Linux device powers up, it can start ntpd as part of its init system. After this ntpd will run in the background and keep the device’s time synchronized with the NTP servers it is configured to communicate with.
An embedded system with no timing hardware should come up with the default Linux time, midnight on January 1st, 1970. Due to this, setting the time requires a large time jump which is usually disallowed by ntpd. To allow a large jump, ntpd must be started with the -g option. With this option, ntpd will allow just one large time jump. After that, ntpd will continue running in the background performing minor adjustments to the time as needed. On startup, ntpd usually takes a minute or two to perform the first time adjustment, so applications that rely on the proper time may need to wait before starting up.