Description: Do not use deprecated Date::Manip TZ variable to set timezone
Forwarded: not-needed
Author: Nick Morrott <knowledgejunkie@gmail.com>
Last-Update: 2015-06-30

--- a/lib/XMLTV.pm.in
+++ b/lib/XMLTV.pm.in
@@ -2123,7 +2123,11 @@
 }
 
 BEGIN {
-  Date::Manip::Date_Init("TZ=UTC");
+    if (int(Date::Manip::DateManipVersion) >= 6) {
+       Date::Manip::Date_Init("SetDate=now,UTC");
+    } else {
+       Date::Manip::Date_Init("TZ=UTC");
+    }
 }
 
 # Override dataElement() to refuse writing empty or whitespace
--- a/filter/tv_extractinfo_en
+++ b/filter/tv_extractinfo_en
@@ -62,10 +62,18 @@
 use strict;
 use XMLTV::Version '$Id: tv_extractinfo_en,v 1.68 2011/05/07 00:21:25 dekarl Exp $ ';
 use XMLTV::Date;
-use Date::Manip; Date_Init('TZ=UTC');
+use Date::Manip;
 use Carp;
 use Getopt::Long;
 
+BEGIN {
+    if (int(Date::Manip::DateManipVersion) >= 6) {
+       Date::Manip::Date_Init("SetDate=now,UTC");
+    } else {
+       Date::Manip::Date_Init("TZ=UTC");
+    }
+}
+
 # Use Log::TraceMessages if installed.
 BEGIN {
     eval { require Log::TraceMessages };
--- a/filter/tv_grep.in
+++ b/filter/tv_grep.in
@@ -516,7 +516,11 @@
 # parse the files.
 #
 t 'setting Date::Manip timezone to UTC';
-Date_Init('TZ=UTC');
+if (int(Date::Manip::DateManipVersion) >= 6) {
+    Date_Init("SetDate=now,UTC");
+} else {
+    Date_Init("TZ=UTC");
+}
 
 @filenames = ('-') if not @filenames;
 my ($encoding, $credits, $ch, $progs) = @{XMLTV::parsefiles(@filenames)};
--- a/filter/tv_remove_some_overlapping
+++ b/filter/tv_remove_some_overlapping
@@ -46,7 +46,15 @@
 use XMLTV::Version '$Id: tv_remove_some_overlapping,v 1.5 2004/01/01 12:31:02 epaepa Exp $ ';
 use XMLTV::Date;
 use Getopt::Long;
-use Date::Manip; Date_Init('TZ=UTC');
+use Date::Manip;
+
+BEGIN {
+    if (int(Date::Manip::DateManipVersion) >= 6) {
+       Date::Manip::Date_Init("SetDate=now,UTC");
+    } else {
+       Date::Manip::Date_Init("TZ=UTC");
+    }
+}
 
 # Use Log::TraceMessages if installed.
 BEGIN {
--- a/filter/tv_sort
+++ b/filter/tv_sort
@@ -60,7 +60,7 @@
 use strict;
 use XMLTV::Version '$Id: tv_sort,v 1.33 2014/06/13 16:11:17 bilbo_uk Exp $ ';
 use XMLTV::Date;
-use Date::Manip; Date_Init('TZ=UTC');
+use Date::Manip;
 use Getopt::Long;
 
 # We use Storable to do 'deep equality' of data structures; this
@@ -68,6 +68,14 @@
 #
 use Storable qw(freeze); $Storable::canonical = 1;
 
+BEGIN {
+    if (int(Date::Manip::DateManipVersion) >= 6) {
+       Date::Manip::Date_Init("SetDate=now,UTC");
+    } else {
+       Date::Manip::Date_Init("TZ=UTC");
+    }
+}
+
 # Use Log::TraceMessages if installed.
 BEGIN {
     eval { require Log::TraceMessages };
--- a/filter/tv_to_potatoe
+++ b/filter/tv_to_potatoe
@@ -48,12 +48,20 @@
 use strict;
 use XMLTV::Version '$Id: tv_to_potatoe,v 1.1 2005/03/14 20:16:04 stesie Exp $ ';
 use IO::File;
-use Date::Manip; Date_Init('TZ=UTC');
+use Date::Manip;
 use Getopt::Long;
 
 sub lisp_quote( $ );
 sub get_best_name( $$ );
 
+BEGIN {
+    if (int(Date::Manip::DateManipVersion) >= 6) {
+       Date::Manip::Date_Init("SetDate=now,UTC");
+    } else {
+       Date::Manip::Date_Init("TZ=UTC");
+    }
+}
+
 # Use Log::TraceMessages if installed.
 BEGIN {
     eval { require Log::TraceMessages };
--- a/filter/tv_to_text
+++ b/filter/tv_to_text
@@ -33,10 +33,18 @@
 use warnings;
 use XMLTV::Version '$Id: tv_to_text,v 1.7 2014/05/25 13:36:32 bilbo_uk Exp $ ';
 use IO::File;
-use Date::Manip; Date_Init('TZ=UTC');
+use Date::Manip;
 use POSIX 'tmpnam';
 use Getopt::Long;
 
+BEGIN {
+    if (int(Date::Manip::DateManipVersion) >= 6) {
+       Date::Manip::Date_Init("SetDate=now,UTC");
+    } else {
+       Date::Manip::Date_Init("TZ=UTC");
+    }
+}
+
 # Use Log::TraceMessages if installed.
 BEGIN {
     eval { require Log::TraceMessages };
--- a/lib/Summarize.pm
+++ b/lib/Summarize.pm
@@ -4,10 +4,18 @@
 use base 'Exporter';
 our @EXPORT = ();
 our @EXPORT_OK = qw(summarize);
-use Date::Manip; Date_Init('TZ=UTC');
+use Date::Manip;
 use XMLTV;
 use XMLTV::TZ qw(gettz ParseDate_PreservingTZ);
 
+BEGIN {
+    if (int(Date::Manip::DateManipVersion) >= 6) {
+       Date::Manip::Date_Init("SetDate=now,UTC");
+    } else {
+       Date::Manip::Date_Init("TZ=UTC");
+    }
+}
+
 =pod
 
 =head1 NAME
--- a/grab/ar/tv_grab_ar
+++ b/grab/ar/tv_grab_ar
@@ -176,12 +176,17 @@
 # So we are not affected by winter/summer timezone
 $XMLTV::DST::Mode='none';
 
-#use XMLTV::TZ 'UTC'; # qw(parse_local_date);
-Date_Init('TZ=UTC');
 use XMLTV::Get_nice;
 use XMLTV::Mode;
 use XMLTV::Date;
 
+BEGIN {
+    if (int(Date::Manip::DateManipVersion) >= 6) {
+       Date::Manip::Date_Init("SetDate=now,UTC");
+    } else {
+       Date::Manip::Date_Init("TZ=UTC");
+    }
+}
 
 sub select_location();
 
--- a/grab/fr/tv_grab_fr
+++ b/grab/fr/tv_grab_fr
@@ -135,7 +135,7 @@
 use XMLTV::Memoize;
 XMLTV::Memoize::check_argv('XMLTV::Get_nice::get_nice_aux');
 
-use Date::Manip; Date_Init("TZ=UTC");
+use Date::Manip;
 use Encode qw(decode_utf8 encode_utf8);
 use Getopt::Long;
 use HTML::Entities;
@@ -143,6 +143,14 @@
 use IO::File;
 use POSIX qw(strftime);
 
+BEGIN {
+    if (int(Date::Manip::DateManipVersion) >= 6) {
+        Date::Manip::Date_Init("SetDate=now,UTC");
+    } else {
+        Date::Manip::Date_Init("TZ=UTC");
+    }
+}
+
 #***************************************************************************
 # Main declarations
 #***************************************************************************
--- a/grab/is/tv_grab_is
+++ b/grab/is/tv_grab_is
@@ -124,6 +124,12 @@
     *d = \&Log::TraceMessages::d;
     Log::TraceMessages::check_argv();
     }
+
+    if (int(Date::Manip::DateManipVersion) >= 6) {
+        Date::Manip::Date_Init("SetDate=now,UTC");
+    } else {
+        Date::Manip::Date_Init("TZ=UTC");
+    }
 }
 
 # default language
@@ -285,8 +291,6 @@
 my $now = parse_date('now');
 die if not defined $now;
 
-Date_Init('TZ=UTC');
-
 # Mapping from cannel ID to URL
 my %stod2AndFriends = (
     "ST2" => "http://www.stod2.is/XML--dagskrar-feed/XML-Stod-2-dagskra-vikunnar",
--- a/grab/na_dd/tv_grab_na_dd.in
+++ b/grab/na_dd/tv_grab_na_dd.in
@@ -630,7 +630,11 @@
 # compute start/stop time
 #
 {
-    Date_Init("TZ=" . offset_to_gmt($opt_tz_offset));
+    if (int(Date::Manip::DateManipVersion) >= 6) {
+        Date::Manip::Date_Init("SetDate=now," . offset_to_gmt($opt_tz_offset));
+    } else {
+        Date::Manip::Date_Init("TZ=" . offset_to_gmt($opt_tz_offset));
+    }
 #
 # TMS bug causes errors around UTC midnight, so let's bump it by a second
 #
--- a/grab/uk_bleb/tv_grab_uk_bleb.in
+++ b/grab/uk_bleb/tv_grab_uk_bleb.in
@@ -125,6 +125,14 @@
 use XMLTV::TZ   qw(tz_to_num);
 #use XMLTV::Supplement qw/GetSupplement/;
 
+BEGIN {
+    if (int(Date::Manip::DateManipVersion) >= 6) {
+        Date::Manip::Date_Init("SetDate=now,UTC");
+    } else {
+        Date::Manip::Date_Init("TZ=UTC");
+    }
+}
+
 # Memoize one routine if possible.
 eval { require Memoize };
 unless ($@) {
@@ -144,7 +152,6 @@
 my $url_channels = "$URL_HOST$URL_DIR";
 
 my $now = parse_date('now');
-Date_Init('TZ=UTC');
 
 # Returns a hash mapping YYYMMDD to URL.
 sub urls_by_date( $$$ ) {
