Code

patches: Added bts332766-negative-timestamps. debian/1.3.8-1
authorSebastian Harl <sh@tokkee.org>
Tue, 2 Jun 2009 16:10:07 +0000 (18:10 +0200)
committerSebastian Harl <sh@tokkee.org>
Tue, 2 Jun 2009 16:10:07 +0000 (18:10 +0200)
This is an upstream patch to fix the handling of negative timestamps in
rrdupdate(1). Thanks to Frank Zacharias for reporting this.

Closes: #332766
debian/changelog
debian/patches/bts332766-negative-timestamps [new file with mode: 0644]
debian/patches/series

index 74a3c4fef20249bf3f6843e871cebac21bbb4037..bdc5837135e98d26b6a6e9daf26e949cbf95b6b1 100644 (file)
@@ -8,6 +8,9 @@ rrdtool (1.3.8-1) unstable; urgency=low
     - Added bts530814-hurd to fix a FTBFS on Hurd, thanks to Marc Dequènes for
       reporting this and providing a patch (Closes: #530814).
     - Removed doc-fixes - applied upstream.
+    - Added bts332766-negative-timestamps - upstream patch to fix the handling
+      of negative timestamps in rrdupdate(1), thanks to Frank Zacharias for
+      reporting this (Closes: #332766).
   * debian/control:
     - Removed transitional package "python-rrd" which is no longer required.
     - Let rrdtool-dbg depend on ${shlibs:Depends}.
@@ -18,7 +21,7 @@ rrdtool (1.3.8-1) unstable; urgency=low
     - Build Python dbg modules into rrdtool-dbg. Add necessary
       (build-) dependencies.
 
- -- Sebastian Harl <tokkee@debian.org>  Mon, 01 Jun 2009 14:13:53 +0200
+ -- Sebastian Harl <tokkee@debian.org>  Mon, 01 Jun 2009 18:49:13 +0200
 
 rrdtool (1.3.7-1) unstable; urgency=low
 
diff --git a/debian/patches/bts332766-negative-timestamps b/debian/patches/bts332766-negative-timestamps
new file mode 100644 (file)
index 0000000..9ae9a15
--- /dev/null
@@ -0,0 +1,15 @@
+diff a/src/rrd_update.c b/src/rrd_update.c
+--- a/src/rrd_update.c
++++ b/src/rrd_update.c
+@@ -972,6 +972,11 @@ static int get_time_from_reading(
+             return -1;
+         };
+         setlocale(LC_NUMERIC, old_locale);
++        if (tmp < 0.0){
++            gettimeofday(&tmp_time, 0);
++            tmp = (double)tmp_time.tv_sec + (double)tmp_time.tv_usec * 1e-6f + tmp;
++        }
++
+         *current_time = floor(tmp);
+         *current_time_usec = (long) ((tmp - (double) *current_time) * 1e6f);
+     }
index 9f5c29fe5e4e088b2d9e8bb2688700a76a713354..93f905b5073ca4fc3f7064e13d5462b719c2e1f9 100644 (file)
@@ -6,3 +6,4 @@ no-rpath-for-perl
 implicit-decl-fix
 compiler-warning-fixes
 bts530814-hurd
+bts332766-negative-timestamps