summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ba1b44e)
raw | patch | inline | side by side (parent: ba1b44e)
author | Sebastian Harl <sh@tokkee.org> | |
Mon, 10 Feb 2014 18:12:49 +0000 (19:12 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Mon, 10 Feb 2014 18:12:49 +0000 (19:12 +0100) |
JSON does not support time values, thus, we need to treat this is a string.
src/core/data.c | patch | blob | history | |
t/core/data_test.c | patch | blob | history |
diff --git a/src/core/data.c b/src/core/data.c
index 735639dcc450f2761dbf0179a70a27d7de784c81..500a62293dbbdc44f53a1db64534554ea91540c0 100644 (file)
--- a/src/core/data.c
+++ b/src/core/data.c
datum->data.datetime))
return -1;
tmp[sizeof(tmp) - 1] = '\0';
- sdb_strbuf_append(buf, "%s", tmp);
+ sdb_strbuf_append(buf, "\"%s\"", tmp);
}
break;
case SDB_TYPE_BINARY:
diff --git a/t/core/data_test.c b/t/core/data_test.c
index e4ead2fe12711484bd5f5c4a42d46076e989c29f..ebff6845df196a702870b781820f88e1050240db 100644 (file)
--- a/t/core/data_test.c
+++ b/t/core/data_test.c
fail_unless(! check,
"sdb_data_format(DATETIME) = %d; expected: 0", check);
string = sdb_strbuf_string(buf);
- expected = "1984-12-06 02:11:54 +0000";
+ expected = "\"1984-12-06 02:11:54 +0000\"";
fail_unless(! strcmp(string, expected),
"sdb_data_format() used wrong format: %s; expected: %s",
string, expected);