summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: da724d1)
raw | patch | inline | side by side (parent: da724d1)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 10 Mar 2007 09:29:18 +0000 (10:29 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 10 Mar 2007 09:29:18 +0000 (10:29 +0100) |
src/csv.c | patch | blob | history |
diff --git a/src/csv.c b/src/csv.c
index 268bdbf57447a49325b3fb448e76694a166ada30..f4b56fe0dc9254755f626bc5bf41b9acb2127510 100644 (file)
--- a/src/csv.c
+++ b/src/csv.c
{
time_t now;
- struct tm *tm;
+ struct tm stm;
- /* TODO: Find a way to minimize the calls to `localtime', since
- * they are pretty expensive.. */
+ /* TODO: Find a way to minimize the calls to `localtime_r',
+ * since they are pretty expensive.. */
now = time (NULL);
- tm = localtime (&now);
+ if (localtime_r (&now, &stm) == NULL)
+ {
+ syslog (LOG_ERR, "csv plugin: localtime_r failed");
+ return (1);
+ }
strftime (buffer + offset, buffer_len - offset,
- "-%Y-%m-%d", tm);
-
- /* `localtime(3)' returns a pointer to static data,
- * therefore the pointer may not be free'd. */
+ "-%Y-%m-%d", &stm);
}
return (0);