diff --git a/libbbfdm-api/legacy/dmcommon.c b/libbbfdm-api/legacy/dmcommon.c index 57d87f3e..5f2af9a1 100644 --- a/libbbfdm-api/legacy/dmcommon.c +++ b/libbbfdm-api/legacy/dmcommon.c @@ -938,10 +938,10 @@ int get_shift_utc_time(int shift_time, char *utc_time, int size) int get_shift_time_time(int shift_time, char *local_time, int size) { time_t t_time; - struct tm *t_tm; + struct tm *t_tm, tm_local; t_time = time(NULL) + shift_time; - t_tm = localtime(&t_time); + t_tm = localtime_r(&t_time, &tm_local); if (t_tm == NULL) return -1; @@ -1067,11 +1067,11 @@ int dm_time_utc_format(time_t ts, char **dst) int dm_time_format(time_t ts, char **dst) { char time_buf[32] = { 0, 0 }; - struct tm *t_tm; + struct tm *t_tm, tm_local; *dst = dmstrdup("0001-01-01T00:00:00+00:00"); - t_tm = localtime(&ts); + t_tm = localtime_r(&ts, &tm_local); if (t_tm == NULL) return -1; diff --git a/libbbfdm/schedules.c b/libbbfdm/schedules.c index 67494589..aced3237 100644 --- a/libbbfdm/schedules.c +++ b/libbbfdm/schedules.c @@ -40,7 +40,7 @@ static int dayname_to_week_day(const char *day) static char *get_status(char *start, char *period, char *day) { - struct tm *info = NULL; + struct tm *info = NULL, tm_local; unsigned int s_day, s_hr, s_min, s_sec, e_day, e_hr, e_min, e_sec; time_t ctime; size_t length, i; @@ -51,7 +51,7 @@ static char *get_status(char *start, char *period, char *day) return "Error"; time(&ctime); - info = localtime(&ctime); + info = localtime_r(&ctime, &tm_local); if (!info) return "Error";