[Pkg-sysvinit-devel] sysv-rc: calculate the seconds correctly :)

Peter Pentchev roam at ringlet.net
Wed Jul 21 09:19:50 UTC 2010


Hi,

First of all, thanks for your work on sysvinit and friends!

What do you think of the following patch which handles the case of the time
zone changing while rc*.d scripts are being run?  Currently, /etc/init.d/rc
may report things like "Running scripts in rc0.d/ tool -10787 seconds" :)
And yes, I know it's marked to be removed before Squeeze is out, but still,
if there is a sysvinit upload in the meantime, this might be a quick and
easy thing to fix :)

Once again, thanks for your work on sysvinit and Debian in general!

G'luck,
Peter

Index: debian/src/sysv-rc/etc/init.d/rc
===================================================================
--- debian/src/sysv-rc/etc/init.d/rc	(revision 1940)
+++ debian/src/sysv-rc/etc/init.d/rc	(working copy)
@@ -336,7 +336,10 @@
 # This code should be removed when Squeeze freeze is getting closer
 # - Petter 2010-05-18
 endtime=$(date +%s)
-duration=$(($endtime - $starttime))
+duration=$((($endtime - $starttime) % 3600))
+if [ "$duration" -lt 0 ]; then
+	duration=$(($duration + 3600))
+fi
 log_action_msg "Running scripts in rc$runlevel.d/ took $duration seconds"
 
 exit 0

-- 
Peter Pentchev	roam at space.bg    roam at ringlet.net    roam at FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
This sentence contains exactly threee erors.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-sysvinit-devel/attachments/20100721/b65d60d6/attachment.pgp>


More information about the Pkg-sysvinit-devel mailing list