Guenter wrote:
> I think the later would be sufficient; f.e. I'm thinking of routers
> which use busybox which only need to sync to one external time source,
> and then provide the fetched time to local intranet clients. My personal
> use at the moment is only ntpdate for sync; I use embeded systems which
> have a RTC, but no battery on board, thus need to sync the hwclock only
> once the system is up, and external (internet) time sources which still
> provide rdate are becoming rare these days...
>
A really awful hack for ntpdate is something like
MYDATE=`awk 'BEGIN{print
"\x1B\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}'
| \
nc -u ntptimeserver -w 1 | \
od -t x1 -j32 -N4 | \
awk 'NR==1 { bar= "0x" $2 $3 $4 $5; print strtonum(bar) - 2208988800}';`
date -d @$MYDATE
This won't work with busybox for a number of reasons, one of which is that
bb date doesn't recognize the @[seconds] format, but the basic logic is
pretty trivial to follow (the initial awk line should spit out a line 48
bytes long, if memory serves), and it'll get you seconds since epoch. I
think you can do something similar with in Busybox (* *date -D %s -d $((
$(./busybox date +%s) - 86400*))* was used as an example in April).
The constant is in 'rdate' already, might be a good starting place for
anyone interested in trying this. (I was gonna gonna gonna, but I'm
unfortunately swamped.)
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox