index 45828b342e88b023b25d84bc5238501bb7315cd6..b24ceac4ac749f1831effab1cb8825b0393701e3 100644 (file)
--- a/src/daemon/utils_time.c
+++ b/src/daemon/utils_time.c
static int get_utc_time (cdtime_t t, struct tm *t_tm, long *nsec) /* {{{ */
{
- struct timespec t_spec;
- int status;
-
- CDTIME_T_TO_TIMESPEC (t, &t_spec);
+ struct timespec t_spec = CDTIME_T_TO_TIMESPEC (t);
NORMALIZE_TIMESPEC (t_spec);
if (gmtime_r (&t_spec.tv_sec, t_tm) == NULL) {
char errbuf[1024];
- status = errno;
+ int status = errno;
ERROR ("get_utc_time: gmtime_r failed: %s",
sstrerror (status, errbuf, sizeof (errbuf)));
return status;
static int get_local_time (cdtime_t t, struct tm *t_tm, long *nsec) /* {{{ */
{
- struct timespec t_spec;
- int status;
-
- CDTIME_T_TO_TIMESPEC (t, &t_spec);
+ struct timespec t_spec = CDTIME_T_TO_TIMESPEC (t);
NORMALIZE_TIMESPEC (t_spec);
if (localtime_r (&t_spec.tv_sec, t_tm) == NULL) {
char errbuf[1024];
- status = errno;
+ int status = errno;
ERROR ("get_local_time: localtime_r failed: %s",
sstrerror (status, errbuf, sizeof (errbuf)));
return status;
@@ -180,7 +174,7 @@ int format_rfc3339 (char *buffer, size_t buffer_size, struct tm const *t_tm, lon
size_left -= len;
}
- sstrncpy (buffer, zone, buffer_size);
+ sstrncpy (pos, zone, size_left);
return 0;
} /* }}} int format_rfc3339 */