};
time_t *time = *((time_t**)(args[0]));
bool utc = *((int*)(args[1]));
- struct tm t;
+ struct tm t, *ret = NULL;
- if (*time == UNDEFINED_TIME)
+ if (*time != UNDEFINED_TIME)
{
- return print_in_hook(data, "--- -- --:--:--%s----",
- utc ? " UTC " : " ");
- }
- if (utc)
- {
- gmtime_r(time, &t);
+ if (utc)
+ {
+ ret = gmtime_r(time, &t);
+ }
+ else
+ {
+ ret = localtime_r(time, &t);
+ }
}
- else
+ if (ret == NULL)
{
- localtime_r(time, &t);
+ return print_in_hook(data, "--- -- --:--:--%s----",
+ utc ? " UTC " : " ");
}
return print_in_hook(data, "%s %02d %02d:%02d:%02d%s%04d",
months[t.tm_mon], t.tm_mday, t.tm_hour, t.tm_min,