[Groonga-commit] groonga/groonga at a44526b [master] msgpack: use double to store time value with old MessagePack

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Apr 5 11:52:26 JST 2018


Kouhei Sutou	2018-04-05 11:52:26 +0900 (Thu, 05 Apr 2018)

  New Revision: a44526bfc168648ee712ab5fa5bf986448641ba8
  https://github.com/groonga/groonga/commit/a44526bfc168648ee712ab5fa5bf986448641ba8

  Message:
    msgpack: use double to store time value with old MessagePack

  Modified files:
    lib/msgpack.c

  Modified: lib/msgpack.c (+4 -1)
===================================================================
--- lib/msgpack.c    2018-04-05 11:47:54 +0900 (0701e5ae6)
+++ lib/msgpack.c    2018-04-05 11:52:26 +0900 (8b134a1a9)
@@ -76,7 +76,10 @@ grn_msgpack_pack_raw_internal(grn_ctx *ctx,
     break;
   case GRN_DB_TIME :
 # if MSGPACK_VERSION_MAJOR < 1
-    msgpack_pack_int64(packer, *((int64_t *)value));
+    {
+      double time_value = (*((int64_t *)value) / GRN_TIME_USEC_PER_SEC_F);
+      msgpack_pack_double(packer, time_value);
+    }
 # else /* MSGPACK_VERSION_MAJOR < 1 */
     /* TODO: Use timestamp time in spec. */
     msgpack_pack_ext(packer, sizeof(int64_t), GRN_MSGPACK_OBJECT_EXT_TIME);
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180405/b153832a/attachment.htm 



More information about the Groonga-commit mailing list
Back to archive index