The branch, master has been updated
       via  d899367f6a884f36066a6908336466c179aa6e5f (commit)
      from  0231fa0b4c6aa53b56f06eff6b8019ed26ff5312 (commit)


- Shortlog ------------------------------------------------------------
d899367 s-s-d: Use system timersub and fix timeval normalization in 
multiplication

Summary of changes:
 ChangeLog                 |    6 ++++++
 THANKS                    |    1 +
 debian/changelog          |    2 ++
 utils/start-stop-daemon.c |   21 ++++-----------------
 4 files changed, 13 insertions(+), 17 deletions(-)
-----------------------------------------------------------------------
Details of changes:

commit d899367f6a884f36066a6908336466c179aa6e5f
Author: Andreas PÃ¥hlsson <[EMAIL PROTECTED]>
Date:   Fri Jan 25 00:15:15 2008 +0200

    s-s-d: Use system timersub and fix timeval normalization in multiplication
    
    Closes: #462225

diff --git a/ChangeLog b/ChangeLog
index 69c26cc..c8742bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-25  Andreas PÃ¥hlsson  <[EMAIL PROTECTED]>
+
+       * utils/start-stop-daemon.c (tsub): Remove function.
+       (tmul): Fix normalization.
+       (run_stop_schedule): Use timersub instead of tsub.
+
 2008-01-24  Raphael Hertzog  <[EMAIL PROTECTED]>
 
        * scripts/dpkg-genchanges.pl: Warn if the current version is
diff --git a/THANKS b/THANKS
index 6109ce9..c61d127 100644
--- a/THANKS
+++ b/THANKS
@@ -6,6 +6,7 @@ Alberto Garcia <[EMAIL PROTECTED]>
 Anand Kumria <[EMAIL PROTECTED]>
 Andreas Barth <[EMAIL PROTECTED]>
 Andreas Metzler <[EMAIL PROTECTED]>
+Andreas PÃ¥hlsson <[EMAIL PROTECTED]>
 Andrew Ferrier <[EMAIL PROTECTED]>
 Andrew Hobson <[EMAIL PROTECTED]>
 Andrew Suffield <[EMAIL PROTECTED]>
diff --git a/debian/changelog b/debian/changelog
index d554e2f..1eb6246 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ dpkg (1.14.17) UNRELEASED; urgency=low
   * Add new keybinding in dselect to restore all selections back to
     whatever's currently installed. Closes: #151540
     Thanks to Colin Watson.
+  * Use system timersub and fix timeval normalization in multiplication in
+    start-stop-daemon. Thanks to Andreas PÃ¥hlsson. Closes: #462225
 
   [ Raphael Hertzog ]
   * Add a warning displayed by dpkg-genchanges if the current version is
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index 79d07c3..1494e55 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -217,25 +217,12 @@ xgettimeofday(struct timeval *tv)
 }
 
 static void
-tsub(struct timeval *r, struct timeval *a, struct timeval *b)
-{
-       r->tv_sec = (time_t)(a->tv_sec - b->tv_sec);
-       r->tv_usec = (suseconds_t)(a->tv_usec - b->tv_usec);
-       if (r->tv_usec < 0) {
-               --r->tv_sec;
-               r->tv_usec += 1000000;
-       }
-}
-
-static void
 tmul(struct timeval *a, int b)
 {
        a->tv_sec *= b;
        a->tv_usec *= b;
-       if (a->tv_usec >= 1000000) {
-               ++a->tv_sec;
-               a->tv_usec -= 1000000;
-       }
+       a->tv_sec = a->tv_sec + a->tv_usec / 1000000;
+       a->tv_usec %= 1000000;
 }
 
 static long
@@ -1200,8 +1187,8 @@ run_stop_schedule(void)
                                if (ratio < 10)
                                        ratio++;
 
-                               tsub(&maxinterval, &stopat, &after);
-                               tsub(&interval, &after, &before);
+                               timersub(&stopat, &after, &maxinterval);
+                               timersub(&after, &before, &interval);
                                tmul(&interval, ratio);
 
                                if (interval.tv_sec < 0 || interval.tv_usec < 0)

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to