@@ -269,7 +269,7 @@ static int json_interp_file(struct ulogd_pluginstance *upi, char *buf)
return ULOGD_IRET_OK;
}
-#define MAX_LOCAL_TIME_STRING 38
+#define MAX_LOCAL_TIME_STRING 80
static int json_interp(struct ulogd_pluginstance *upi)
{
@@ -305,8 +305,8 @@ static int json_interp(struct ulogd_pluginstance *upi)
snprintf(opi->cached_tz, sizeof(opi->cached_tz),
"%c%02ld%02ld",
t->tm_gmtoff > 0 ? '+' : '-',
- labs(t->tm_gmtoff) / 60 / 60,
- labs(t->tm_gmtoff) / 60 % 60);
+ labs(t->tm_gmtoff) % 86400 / 60 / 60,
+ labs(t->tm_gmtoff) % 86400 / 60 % 60);
}
if (pp_is_valid(inp, opi->usec_idx)) {
Mod gmt offset by 86400 to give the compiler a hint. Make date-time buffer big enough to fit all integer values. Signed-off-by: Jeremy Sowden <jeremy@azazel.net> --- output/ulogd_output_JSON.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)