From dfd957059d0477ed8b2d640526bd0be7e5e27f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20T=C3=B6rnblom?= Date: Mon, 3 Sep 2012 17:00:14 +0200 Subject: [PATCH] use thread safe version of localtime when generating dvr playlists --- src/webui/webui.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/webui/webui.c b/src/webui/webui.c index 2f5dec09..78b92bad 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -369,6 +369,7 @@ http_dvr_list_playlist(http_connection_t *hc) const char *host; off_t fsize; time_t durration; + struct tm tm; int bandwidth; hq = &hc->hc_reply; @@ -383,7 +384,7 @@ http_dvr_list_playlist(http_connection_t *hc) durration = de->de_stop - de->de_start; durration += (de->de_stop_extra + de->de_start_extra)*60; bandwidth = ((8*fsize) / (durration*1024.0)); - strftime(buf, sizeof(buf), "%FT%T%z", localtime(&(de->de_start))); + strftime(buf, sizeof(buf), "%FT%T%z", localtime_r(&(de->de_start), &tm)); htsbuf_qprintf(hq, "#EXTINF:%"PRItime_t",%s\n", durration, lang_str_get(de->de_title, NULL)); @@ -413,6 +414,7 @@ http_dvr_playlist(http_connection_t *hc, dvr_entry_t *de) time_t durration = 0; off_t fsize = 0; int bandwidth = 0; + struct tm tm; const char *host = http_arg_get(&hc->hc_args, "Host"); durration = de->de_stop - de->de_start; @@ -422,7 +424,7 @@ http_dvr_playlist(http_connection_t *hc, dvr_entry_t *de) if(fsize) { bandwidth = ((8*fsize) / (durration*1024.0)); - strftime(buf, sizeof(buf), "%FT%T%z", localtime(&(de->de_start))); + strftime(buf, sizeof(buf), "%FT%T%z", localtime_r(&(de->de_start), &tm)); htsbuf_qprintf(hq, "#EXTM3U\n"); htsbuf_qprintf(hq, "#EXTINF:%"PRItime_t",%s\n", durration, lang_str_get(de->de_title, NULL));