Author Topic: date command  (Read 2990 times)

orthogonal

  • Newbie
  • *
  • Posts: 34
    • View Profile
date command
« on: May 04, 2004, 09:33:54 am »
The Zaurus date command ignores seconds when setting the time:
date 010203042005.06
should set the date to January 2nd 03:04:06 (am) 2005, but actually sets the time to January 2nd 03:04 (am) 2005

How can I set the seconds? Something in /proc?

Thanks.
Sharp Zaurus 5600  \"Special ROM\" 1.3   Ambicomm WL1100C CF Wifi  SanDisk 512MB SD

doc

  • Full Member
  • ***
  • Posts: 191
    • View Profile
    • http://
date command
« Reply #1 on: May 04, 2004, 11:44:08 am »
I think it is a bug in the date command...the .ss doesn\'t seem to work.  If you have network access you can set it via the network or use ntp?
By your command...

Doc
Sharp SL-5500 PDA
Sharp 2.78 ROM
Viking 256MB SD
Socket LP-E CF Ethernet

orthogonal

  • Newbie
  • *
  • Posts: 34
    • View Profile
date command
« Reply #2 on: May 04, 2004, 12:08:16 pm »
Actually, the issue came up after I wrote  a script to set the date via the \"daytime\" service. (ntp is more accurate, but involves more overhead, so I decided daytime was sufficient for me.)

This is the script:
# cat /usr/local/bin/settime
echo \"Time was: `date`\"
if [[ $1 ]]; then
u=$1
else
u=\"time-b.timefreq.bldrdoc.gov\"
fi
echo \"Setting time by $u\"
t=`telnet $u 13`
#echo $?
echo \"$t\"
ss=${t:10:2}${t:13:2}${t:16:2}${t:19:2}20${t:7:2}.${t:22:2}
echo \"Zaurus \'date\' set command ignores seconds\"
echo \"Time set to: `sudo date -u $ss`\"
echo \"Local time : `date`\"
#echo $ss
echo \"Taskbar time may not immediately update.\"

I could write the script to sleep until the seconds were zero, but to accurately deal with carries in the date/time (59-]00), I\'d either have to do a lot of calculation, or -- more simply -- telnet the daytime again. The other problem is that the sleeping could take up to 59 seconds, which would make it problematic to use this script as part of an .rc, especially as the script -- why, I don\'t know -- doesn\'t work if run in the background.

I was hoping to avoid such kludges by finding a way to set the seconds.
Sharp Zaurus 5600  \"Special ROM\" 1.3   Ambicomm WL1100C CF Wifi  SanDisk 512MB SD

doc

  • Full Member
  • ***
  • Posts: 191
    • View Profile
    • http://
date command
« Reply #3 on: May 04, 2004, 01:52:58 pm »
Maybe a newer version of busybox would have a \"date\" command that worked properly?  Anyone?
By your command...

Doc
Sharp SL-5500 PDA
Sharp 2.78 ROM
Viking 256MB SD
Socket LP-E CF Ethernet