OESF Portables Forum
Everything Else => Desktop Operating Systems Issues => Zaurus General Forums => Archived Forums => Linux Issues => Topic started by: orthogonal 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.
-
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?
-
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.
-
Maybe a newer version of busybox would have a \"date\" command that worked properly? Anyone?