diff --git a/src/core/data.c b/src/core/data.c
index 444f5a1c91053d7f30665603fccaea394281d33e..d176b891e8e7dd71476dbaebe6c6cb82b5952884 100644 (file)
--- a/src/core/data.c
+++ b/src/core/data.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <strings.h>
#include <math.h>
/* in the worst case, each character needs to be escaped */
return 2 * strlen(datum->data.string) + 2;
case SDB_TYPE_DATETIME:
- /* "YYYY-MM-DD HH:MM:SS +zzzz" */
- return 27;
+ /* "YYYY-MM-DD HH:MM:SS[.nnnnnnnnn] +zzzz" */
+ return 37;
case SDB_TYPE_BINARY:
if (! datum->data.binary.datum)
return 6; /* NULL */
@@ -1013,8 +1014,7 @@ sdb_data_format(const sdb_data_t *datum, char *buf, size_t buflen, int quoted)
}
}
else if (datum->type == SDB_TYPE_DATETIME) {
- if (! sdb_strftime(tmp, sizeof(tmp), "%F %T %z",
- datum->data.datetime))
+ if (! sdb_strftime(tmp, sizeof(tmp), datum->data.datetime))
return -1;
tmp[sizeof(tmp) - 1] = '\0';
data = tmp;
return -1;
if (regcomp(&tmp.data.re.regex, tmp.data.re.raw,
REG_EXTENDED | REG_ICASE | REG_NOSUB)) {
- sdb_log(SDB_LOG_ERR, "core: Failed to compile regular "
+ sdb_log(SDB_LOG_ERR, "Failed to compile regular "
"expression '%s'", tmp.data.re.raw);
free(tmp.data.re.raw);
return -1;
|| (type == SDB_TYPE_DATETIME)) {
if (errno || (str == endptr)) {
char errbuf[1024];
- sdb_log(SDB_LOG_ERR, "core: Failed to parse string "
+ sdb_log(SDB_LOG_ERR, "Failed to parse string "
"'%s' as numeric value (type %i): %s", str, type,
sdb_strerror(errno, errbuf, sizeof(errbuf)));
return -1;
}
else if (endptr && (*endptr != '\0'))
- sdb_log(SDB_LOG_WARNING, "core: Ignoring garbage after "
+ sdb_log(SDB_LOG_WARNING, "Ignoring garbage after "
"number while parsing numeric value (type %i): %s.",
type, endptr);
}