Difference between revisions of "Setting the System Time"
(Created page with "{{todo|Port and polish|Klint Youngmeyer|project=oe 4,oe 5,ky}}") |
Kyoungmeyer (talk | contribs) |
||
Line 1: | Line 1: | ||
− | {{todo|Port and polish|Klint Youngmeyer|project=oe 4,oe 5,ky}} | + | {{todo|Port and polish and finish|Klint Youngmeyer|project=oe 4,oe 5,ky}} |
+ | |||
+ | |||
+ | == Setting the System Time on EMAC OE Products == | ||
+ | |||
+ | |||
+ | During boot, they system will call the program <code>ntpdate</code> to set the time from an NTP server. This requires that the device has Internet access. To do this manually run the following command: | ||
+ | |||
+ | <syntaxhighlight lang="console"> | ||
+ | $ ntpdate pool.ntp.org | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | The example above uses the server <code>pool.ntp.org</code> which will retrieve a randomly chosen public NTP server. However, the choice of time server is arbitrary and can be set according to the users' needs. If the device does not have Internet access, then the system date can be set using the following command: | ||
+ | |||
+ | <syntaxhighlight lang="console"> | ||
+ | $ date -s "<date_format>" | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | The argument <code><date_format></code> can be any of the following: | ||
+ | <syntaxhighlight lang="console"> | ||
+ | "hh:mm[:ss]" | ||
+ | "[YYYY.]MM.DD-hh:mm[:ss]" | ||
+ | "YYYY-MM-DD hh:mm[:ss]" | ||
+ | "MMDDhhmm[[YY]YY][.ss]" | ||
+ | </syntaxhighlight> | ||
+ | hh = hour<br /> | ||
+ | mm = minute<br /> | ||
+ | ss = second<br /> | ||
+ | YYYY = four-digit year<br /> | ||
+ | MM = month<br /> | ||
+ | DD = day<br /> | ||
+ | [YY]YY = four-digit year where the first two digits are optional<br /> | ||
+ | |||
+ | |||
+ | {{Fmbox | type = | text = Any portion of format string such as [:ss] with square brackets is optional for that format string. The format string must be quoted as shown above to work correctly.}} | ||
+ | |||
+ | |||
+ | On shutdown the system time is saved to the hardware clock automatically with the following command:<syntaxhighlight lang="console">/etc/init.d/hwclock.sh stop</syntaxhighlight>To do this manually after setting the date run the following command:<syntaxhighlight lang="console">/etc/init.d/hwclock.sh restart</syntaxhighlight> |
Revision as of 17:19, 3 October 2013
Setting the System Time on EMAC OE Products
During boot, they system will call the program ntpdate
to set the time from an NTP server. This requires that the device has Internet access. To do this manually run the following command:
$ ntpdate pool.ntp.org
The example above uses the server pool.ntp.org
which will retrieve a randomly chosen public NTP server. However, the choice of time server is arbitrary and can be set according to the users' needs. If the device does not have Internet access, then the system date can be set using the following command:
$ date -s "<date_format>"
The argument <date_format>
can be any of the following:
"hh:mm[:ss]"
"[YYYY.]MM.DD-hh:mm[:ss]"
"YYYY-MM-DD hh:mm[:ss]"
"MMDDhhmm[[YY]YY][.ss]"
hh = hour
mm = minute
ss = second
YYYY = four-digit year
MM = month
DD = day
[YY]YY = four-digit year where the first two digits are optional
Any portion of format string such as [:ss] with square brackets is optional for that format string. The format string must be quoted as shown above to work correctly. |
On shutdown the system time is saved to the hardware clock automatically with the following command:
/etc/init.d/hwclock.sh stop
To do this manually after setting the date run the following command:
/etc/init.d/hwclock.sh restart