]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
use thread safe version of localtime when generating dvr playlists
authorJohn Törnblom <john.tornblom@gmail.com>
Mon, 3 Sep 2012 15:00:14 +0000 (17:00 +0200)
committerJohn Törnblom <john.tornblom@gmail.com>
Mon, 3 Sep 2012 15:00:58 +0000 (17:00 +0200)
src/webui/webui.c

index 2f5dec09484e2b11874afc81bf0b7cda2af690f8..78b92bad9fff3dc6e4eff969008213c03ae9e834 100644 (file)
@@ -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));