Signed-off-by: Doan Tran Cong Danh <congdanhqx@xxxxxxxxx> --- date.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/date.c b/date.c index ca71736a9f..b0d9a8421d 100644 --- a/date.c +++ b/date.c @@ -64,10 +64,10 @@ static time_t gm_time_t(timestamp_t time, int tz) * thing, which means that tz -0100 is passed in as the integer -100, * even though it means "sixty minutes off" */ -static struct tm *time_to_tm(timestamp_t time, int tz) +static struct tm *time_to_tm(timestamp_t time, int tz, struct tm *tm) { time_t t = gm_time_t(time, tz); - return gmtime(&t); + return gmtime_r(&t, tm); } static struct tm *time_to_tm_local(timestamp_t time, struct tm *tm) @@ -321,9 +321,9 @@ const char *show_date(timestamp_t time, int tz, const struct date_mode *mode) if (mode->local) tm = time_to_tm_local(time, &tmbuf); else - tm = time_to_tm(time, tz); + tm = time_to_tm(time, tz, &tmbuf); if (!tm) { - tm = time_to_tm(0, 0); + tm = time_to_tm(0, 0, &tmbuf); tz = 0; } -- 2.24.0.158.gd77a74f4dd.dirty