Diff for /loncom/interface/loncommon.pm between versions 1.679.2.4 and 1.679.2.5

version 1.679.2.4, 2008/09/19 23:03:20 version 1.679.2.5, 2008/09/19 23:09:29
Line 3353  sub pprmlink { Line 3353  sub pprmlink {
   
   
 sub timehash {  sub timehash {
     my @ltime=localtime(shift);      my ($thistime) = @_;
     return ( 'seconds' => $ltime[0],      my $timezone = &Apache::lonlocal::gettimezone();
              'minutes' => $ltime[1],      my $dt = DateTime->from_epoch(epoch => $thistime)
              'hours'   => $ltime[2],                       ->set_time_zone($timezone);
              'day'     => $ltime[3],      my $wday = $dt->day_of_week();
              'month'   => $ltime[4]+1,      if ($wday == 7) { $wday = 0; }
              'year'    => $ltime[5]+1900,      return ( 'second' => $dt->second(),
              'weekday' => $ltime[6],               'minute' => $dt->minute(),
              'dayyear' => $ltime[7]+1,               'hour'   => $dt->hour(),
              'dlsav'   => $ltime[8] );               'day'     => $dt->day_of_month(),
                'month'   => $dt->month(),
                'year'    => $dt->year(),
                'weekday' => $wday,
                'dayyear' => $dt->day_of_year(),
                'dlsav'   => $dt->is_dst() );
 }  }
   
 sub utc_string {  sub utc_string {
Line 3372  sub utc_string { Line 3377  sub utc_string {
   
 sub maketime {  sub maketime {
     my %th=@_;      my %th=@_;
       my ($epoch_time,$timezone,$dt);
       $timezone = &Apache::lonlocal::gettimezone();
       eval {
           $dt = DateTime->new( year   => $th{'year'},
                                month  => $th{'month'},
                                day    => $th{'day'},
                                hour   => $th{'hour'},
                                minute => $th{'minute'},
                                second => $th{'second'},
                                time_zone => $timezone,
                            );
       };
       if (!$@) {
           $epoch_time = $dt->epoch;
           if ($epoch_time) {
               return $epoch_time;
           }
       }
     return POSIX::mktime(      return POSIX::mktime(
         ($th{'seconds'},$th{'minutes'},$th{'hours'},          ($th{'seconds'},$th{'minutes'},$th{'hours'},
          $th{'day'},$th{'month'}-1,$th{'year'}-1900,0,0,-1));           $th{'day'},$th{'month'}-1,$th{'year'}-1900,0,0,-1));

Removed from v.1.679.2.4  
changed lines
  Added in v.1.679.2.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>