[LON-CAPA-cvs] cvs: loncom /automation batchcreatecourse.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 26 May 2006 15:37:16 -0000


albertel		Fri May 26 11:37:16 2006 EDT

  Modified files:              
    /loncom/automation	batchcreatecourse.pm 
  Log:
  - style
  - leap year detector missed the special case years
  
  
Index: loncom/automation/batchcreatecourse.pm
diff -u loncom/automation/batchcreatecourse.pm:1.11 loncom/automation/batchcreatecourse.pm:1.12
--- loncom/automation/batchcreatecourse.pm:1.11	Tue May 23 14:34:40 2006
+++ loncom/automation/batchcreatecourse.pm	Fri May 26 11:37:14 2006
@@ -1,5 +1,5 @@
 #
-# $Id: batchcreatecourse.pm,v 1.11 2006/05/23 18:34:40 raeburn Exp $
+# $Id: batchcreatecourse.pm,v 1.12 2006/05/26 15:37:14 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -629,7 +629,7 @@
     if ($timestr !~ /:/) {
         $timestamp = '';
     } else {
-        my @entries = split/:/,$timestr;
+        my @entries = split(/:/,$timestr);
         for (my $j=0; $j<@entries; $j++) {
             if ( length($entries[$j]) > 1 ) {
                 $entries[$j] =~ s/^0//;
@@ -668,9 +668,12 @@
                 $entries[2] = 29;
             }
             if ($entries[2] == 29) {
-                unless ($entries[0]%4 == 0) {
+                if ($entries[0]%4 != 0) {
                     $entries[2] == 28;
-                }
+                } elsif ( $entries[0]%100 == 0
+			  && $entries[0]%400 != 0) {
+		    $entries[2] == 28;
+		}
             }
         }     
         $timestamp =  timelocal($entries[5],$entries[4],$entries[3],$entries[2],$entries[1],$entries[0]);