[BusyBox] (patch) rdate - show time difference
Rob Landley
rob at landley.net
Mon May 2 10:09:52 UTC 2005
On Monday 02 May 2005 06:29 am, walter harms wrote:
> hi rob,
> hi list
>
> i do not know the traditional rdate command (normaly i use netdate and
> that shows the diff).
The diff could also be worked out from:
rdate -p clock.psu.edu && date
A simple script could probably do what you wanted without modifying rdate at
all, in fact. Since you only one one second granularity, something vaguely
like:
newdate=`rdate -p clock.psu.edu`
olddate=`date +$format`
date -s $newdate +$format
offset=$[`date -d $newdate +$format` - `date -d $olddate +$format`]
Presumably it should run fast enough to avoid any major loss of accuracy.
(And if you're worried that the program might get interrupted and something
higher priority run between fetching and setting the date; the same is true
of the C program too. Smaller window. You could run date once just before
rdate to bring it into cache if you care about that, but again, with 1 second
granularity...)
Rob
More information about the busybox
mailing list