Code

write_mongodb plugin: Actually store time as "date" type.
authorFlorian Forster <octo@collectd.org>
Mon, 5 Mar 2012 09:35:58 +0000 (10:35 +0100)
committerFlorian Forster <octo@collectd.org>
Mon, 5 Mar 2012 09:35:58 +0000 (10:35 +0100)
src/write_mongodb.c

index f61d6224f09705cb75efc425f37a7a03d89aea72..4f866bc84fc9158a2a266518fe2942a63dfa52f1 100644 (file)
@@ -87,7 +87,7 @@ static int wm_write (const data_set_t *ds, /* {{{ */
   ssnprintf(collection_name, sizeof (collection_name), "collectd.%s", vl->plugin);
 
   bson_init(&record);
-  bson_append_double (&record, "time", CDTIME_T_TO_DOUBLE (vl->time));
+  bson_append_date (&record, "time", (bson_date_t) CDTIME_T_TO_MS (vl->time));
   bson_append_string (&record, "host", vl->host);
   bson_append_string (&record, "plugin_instance", vl->plugin_instance);
   bson_append_string (&record, "type", vl->type);