summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/utils.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/utils.c b/src/utils.c
index ede1303..d08b83a 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -507,21 +507,16 @@ char *
date_sec2date_str (long sec, char *datefmt)
{
struct tm *lt;
- time_t t;
- char *datestr;
-
- datestr = (char *) mem_calloc (BUFSIZ, sizeof (char));
+ char *datestr = (char *) mem_calloc (BUFSIZ, sizeof (char));
if (sec == 0)
(void)snprintf (datestr, BUFSIZ, "0");
- else
- {
- t = sec;
- lt = localtime (&t);
- strftime (datestr, BUFSIZ, datefmt, lt);
- }
+ else {
+ lt = localtime ((time_t *)&sec);
+ strftime (datestr, BUFSIZ, datefmt, lt);
+ }
- return (datestr);
+ return datestr;
}
/* Generic function to format date. */