summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 29e1b81)
raw | patch | inline | side by side (parent: 29e1b81)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 18 Aug 2012 16:12:43 +0000 (18:12 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sat, 18 Aug 2012 16:12:43 +0000 (18:12 +0200) |
This way, the value may directly be used as a timestamp value in PostgreSQL.
src/postgresql.c | patch | blob | history |
diff --git a/src/postgresql.c b/src/postgresql.c
index d6e04a85ad2d75baac05b2d3807211e870dfe930..7bc450eaae51bc20c413c2e36269c4760432d62e 100644 (file)
--- a/src/postgresql.c
+++ b/src/postgresql.c
{
c_psql_database_t *db;
- char time_str[1024];
+ char time_str[32];
char values_name_str[1024];
char values_str[1024];
assert (db->database != NULL);
assert (db->writers != NULL);
- ssnprintf (time_str, sizeof (time_str),
- "%f", CDTIME_T_TO_DOUBLE (vl->time));
+ if (cdtime_to_iso8601 (time_str, sizeof (time_str), vl->time) == 0) {
+ log_err ("c_psql_write: Failed to convert time to ISO 8601 format");
+ return -1;
+ }
if (values_name_to_sqlarray (ds,
values_name_str, sizeof (values_name_str)) == NULL)