[rrd-users] [PATCH] invalid times when calling fetch with ruby bindings

Mike Perham mperham at gmail.com
Thu Nov 8 05:54:26 CET 2007


Index: main.c
===================================================================
--- main.c	(revision 8873)
+++ main.c	(working copy)
@@ -129,11 +130,12 @@
     }
     free(raw_data);

-    result = rb_ary_new2(4);
-    rb_ary_store(result, 0, INT2FIX(start));
-    rb_ary_store(result, 1, INT2FIX(end));
+    result = rb_ary_new2(5);
+    rb_ary_store(result, 0, INT2NUM(start));
+    rb_ary_store(result, 1, INT2NUM(end));
     rb_ary_store(result, 2, names);
     rb_ary_store(result, 3, data);
+    rb_ary_store(result, 4, INT2FIX(step));

The solution to the corruption is to use the INT2NUM macro, not
INT2FIX.  The latter can lose data on large integers.

Please note the diff above also adds the step value to the returned
results.  This would be a very useful addition to the API for us.



More information about the rrd-users mailing list