On Jan 3, 2014 1:29 PM, "Etienne CHAMPETIER" <etienne.champet...@free.fr> wrote: > > Simply scan for the most recent file in /etc and set > system time to this file modification time if it's in the future > It allow some time dependent program to work immediatly > without waiting for ntpd to sync > Thanks to Bastian Bittorf for the (so) simple idea > > Signed-off-by: Etienne CHAMPETIER <etienne.champet...@free.fr> > --- > package/base-files/files/etc/init.d/sysfixtime | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > create mode 100755 package/base-files/files/etc/init.d/sysfixtime > > diff --git a/package/base-files/files/etc/init.d/sysfixtime b/package/base-files/files/etc/init.d/sysfixtime > new file mode 100755 > index 0000000..2e8d4ab > --- /dev/null > +++ b/package/base-files/files/etc/init.d/sysfixtime > @@ -0,0 +1,13 @@ > +#!/bin/sh /etc/rc.common > +# Copyright (C) 2013-2014 OpenWrt.org > + > +START=00 > + > +boot() { > + CURTIME=`date +%s` > + MAXTIME=`find /etc -type f -exec date +%s -r {} \; | sort | tail -n1` > + [[ $CURTIME -lt $MAXTIME ]] && \ Strictly speaking, should probably be 'sort -n'.
> + date -s @$MAXTIME && \ > + /usr/bin/logger -t sysfixtime -p daemon.notice "Time fixed" > +} > + > -- > 1.8.4.2 > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel