Setting Date and Time

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(Phone stack should set the time/date as well.)
(Setting date from the command prompt)
Line 1: Line 1:
== Setting date from the command prompt ==
+
== Setting the date/time using "date" ==
  
To change the date on your Freerunner you have to give the command
+
To change the date on your Freerunner, issue one of the following commands:
  
 
  date -s ''MMDDhhmm''
 
  date -s ''MMDDhhmm''
 
or
 
 
 
  date -s ''MMDDhhmmYYYY''
 
  date -s ''MMDDhhmmYYYY''
 
or
 
 
 
  date -s ''MMDDhhmmYYYY.ss''
 
  date -s ''MMDDhhmmYYYY.ss''
  
 
where ''MM'' is the month, 01-12; ''DD'' is the day, 01-31; ''hhmm'' is the time, 0000-2359; ''YYYY'' is the optional year, and ''.ss'' is the optional seconds.
 
where ''MM'' is the month, 01-12; ''DD'' is the day, 01-31; ''hhmm'' is the time, 0000-2359; ''YYYY'' is the optional year, and ''.ss'' is the optional seconds.
 +
 +
== Setting the date/time automatically with NTP ==
  
 
If your Freerunner is connected to the internet, you can instead set the time automatically:
 
If your Freerunner is connected to the internet, you can instead set the time automatically:
Line 20: Line 16:
 
   ntpclient -s -h pool.ntp.org
 
   ntpclient -s -h pool.ntp.org
  
Finally, sync the hardware clock with the system time to make your change persist over reboots:
+
== Syncing the hardware clock ==
 +
 
 +
No matter which method you used above, sync the hardware clock with the system time to make your change persist over reboots:
  
 
  hwclock --systohc
 
  hwclock --systohc
Line 26: Line 24:
 
See also [[Timezone]] for changing the time zone.
 
See also [[Timezone]] for changing the time zone.
  
===Future Work===
+
== Future Work ==
 +
 
 
Presumably it might also be possible to use gpspipe (or something else) to set the date once you have a gps fix?  In addition, the phone stack should set the date, time, and timezone once connected to a network.
 
Presumably it might also be possible to use gpspipe (or something else) to set the date once you have a gps fix?  In addition, the phone stack should set the date, time, and timezone once connected to a network.
  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Guides]]
 
[[Category:Guides]]

Revision as of 04:27, 17 July 2008

Contents

Setting the date/time using "date"

To change the date on your Freerunner, issue one of the following commands:

date -s MMDDhhmm
date -s MMDDhhmmYYYY
date -s MMDDhhmmYYYY.ss

where MM is the month, 01-12; DD is the day, 01-31; hhmm is the time, 0000-2359; YYYY is the optional year, and .ss is the optional seconds.

Setting the date/time automatically with NTP

If your Freerunner is connected to the internet, you can instead set the time automatically:

 opkg install ntpclient
 ntpclient -s -h pool.ntp.org

Syncing the hardware clock

No matter which method you used above, sync the hardware clock with the system time to make your change persist over reboots:

hwclock --systohc

See also Timezone for changing the time zone.

Future Work

Presumably it might also be possible to use gpspipe (or something else) to set the date once you have a gps fix? In addition, the phone stack should set the date, time, and timezone once connected to a network.

Personal tools

Setting date from the command prompt

To change the date on your Freerunner you have to give the command

date -s MMDDhhmm

or

date -s MMDDhhmmYYYY

or

date -s MMDDhhmmYYYY.ss

where MM is the month, 01-12; DD is the day, 01-31; hhmm is the time, 0000-2359; YYYY is the optional year, and .ss is the optional seconds.

If your Freerunner is connected to the internet, you can instead set the time automatically:

 opkg install ntpclient
 ntpclient -s -h pool.ntp.org

Finally, sync the hardware clock with the system time to make your change persist over reboots:

hwclock --systohc

See also Timezone for changing the time zone.

Future Work

Presumably it might also be possible to use gpspipe (or something else) to set the date once you have a gps fix? In addition, the phone stack should set the date, time, and timezone once connected to a network.