[LON-CAPA-cvs] cvs: loncom /interface lonclonecourse.pm

raeburn raeburn at source.lon-capa.org
Sat Jun 29 19:21:05 EDT 2019


raeburn		Sat Jun 29 23:21:05 2019 EDT

  Modified files:              
    /loncom/interface	lonclonecourse.pm 
  Log:
  - Trap invalid date error in DateTime.pm during date shift. Typical cause is
    creation of new date in "lost hour" on day of change to Daylight Savings.
  
  
Index: loncom/interface/lonclonecourse.pm
diff -u loncom/interface/lonclonecourse.pm:1.12 loncom/interface/lonclonecourse.pm:1.13
--- loncom/interface/lonclonecourse.pm:1.12	Thu Jan 21 00:12:38 2016
+++ loncom/interface/lonclonecourse.pm	Sat Jun 29 23:21:05 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # routines for clone a course
 #
-# $Id: lonclonecourse.pm,v 1.12 2016/01/21 00:12:38 raeburn Exp $
+# $Id: lonclonecourse.pm,v 1.13 2019/06/29 23:21:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -220,8 +220,14 @@
                         if (($origtz eq 'local') && (!$ENV{TZ})) {
                             $ENV{TZ} = $dt->time_zone()->name();
                         }
-                        $dt->add(days => int($date_shift));
-                        $newdata{$thiskey} = $dt->epoch();
+                        eval {
+                            $dt->add(days => int($date_shift));
+                        };
+                        if ($@) {
+                            $newdata{$thiskey} = $newdata{$thiskey}+$delta+(60*60);
+                        } else {
+                            $newdata{$thiskey} = $dt->epoch();
+                        }
                     } else {
                         $newdata{$thiskey} = $newdata{$thiskey}+$delta;
                     }




More information about the LON-CAPA-cvs mailing list