[med-svn] [dcmtk] 05/06: Update time compare patch

Gert Wollny gewo at moszumanska.debian.org
Thu Jun 22 16:48:24 UTC 2017


This is an automated email from the git hooks/post-receive script.

gewo pushed a commit to branch master
in repository dcmtk.

commit c3d3080f17667c387b5b7dfbffc9814c4cfe4123
Author: Gert Wollny <gewo at debian.org>
Date:   Thu Jun 22 10:00:31 2017 +0000

    Update time compare patch
---
 debian/patches/09_round_time.patch | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/debian/patches/09_round_time.patch b/debian/patches/09_round_time.patch
index f4f3464..8cf7a1b 100644
--- a/debian/patches/09_round_time.patch
+++ b/debian/patches/09_round_time.patch
@@ -5,14 +5,38 @@ Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859204
 
 --- a/ofstd/libsrc/oftime.cc
 +++ b/ofstd/libsrc/oftime.cc
-@@ -491,6 +491,10 @@
+@@ -47,6 +47,7 @@
+ #include "dcmtk/ofstd/oftime.h"
+ #include "dcmtk/ofstd/ofstd.h"
+ 
++#include <cmath> 
+ 
+ /*------------------*
+  *  implementation  *
+@@ -99,13 +100,16 @@
+ 
+ OFBool OFTime::operator==(const OFTime &timeVal) const
+ {
+-    return (getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/) == timeVal.getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/));
++    // Dicom supports at most 6 decimal digits, to compare cut off to eliminate numerical errors.
++    double me = rint(getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/) * 1000000);
++    double other =  rint(timeVal.getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/) * 1000000);
++    return me == other; 
+ }
+ 
+ 
+ OFBool OFTime::operator!=(const OFTime &timeVal) const
+ {
+-    return (getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/) != timeVal.getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/));
++  return ! (*this == timeVal); 
+ }
+ 
+ 
+@@ -491,6 +495,7 @@
  {
      /* compute number of seconds since 00:00:00 */
      double result = ((OFstatic_cast(double, hour) - timeZone) * 60 + OFstatic_cast(double, minute)) * 60 + second;
 +
-+    /* Dicom supports only six decimal digits, but floating point operations might introduce errors */
-+    result = round(result * 1000000.0) / 1000000.0; 
-+    
      /* normalize the result to the range [0.0,86400.0[ */
      if (normalize)
          result -= OFstatic_cast(double, OFstatic_cast(unsigned long, result / 86400) * 86400);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/dcmtk.git



More information about the debian-med-commit mailing list