Skip Menu |
 

This queue is for tickets about the Weather-Com CPAN distribution.

Report information
The Basics
Id: 46508
Status: open
Priority: 0/
Queue: Weather-Com

People
Owner: Nobody in particular
Requestors: uwe.zimmermann [...] sciencetronics.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.5.5
Fixed in: (no value)



Subject: Time/Date bug
Download (untitled) / with headers
text/plain 1.1k
The conversion of the weather.com lsup-date/time is wrong in the current version of weather::com. The conversion does not correctly interpret the AM/PM times around midnight which for weather.com follow the standard US notation (which by no means is logical). Midnight according to US standards is 12AM of the new day, while noon is 12PM of that day. The hour between midnight and 1AM according to US standards is counted at 12PM(!) i.e. the clock goes backwards when going from 12:59AM to 1:00AM. However the time conversion within weather::com currently gives the following results, i.e. it assumes that the first hour of the day is given as 0AM: lsup '5/29/09 9:20 PM Local Time' -> 2009-05-29 21:20:00 local time lsup '5/29/09 11:20 PM Local Time' -> 2009-05-29 23:20:00 local time lsup '5/29/09 11:59 PM Local Time' -> 2009-05-29 23:59:00 local time lsup '5/29/09 0:20 AM Local Time' -> 2009-05-29 00:20:00 local time lsup '5/29/09 12:20 AM Local Time' -> 2009-05-29 12:20:00 local time lsup '5/29/09 12:20 PM Local Time' -> 2009-05-30 00:20:00 local time see also: http://en.wikipedia.org/wiki/12-hour_clock http://www.mathsisfun.com/time.html Thanks for a great tool! Uwe.
Subject: weathercom_timetest.pl
#!/usr/bin/perl -w # $Revision: 1.1 $ use DBI; use Weather::Com; #=============================================================================== my $lsup = Weather::Com::DateTime->new(2); # CEST my $date = '5/29/09 9:20 PM Local Time'; $lsup->set_lsup($date); print sprintf("lsup '%s' -> %s local time\n",$date,$lsup->formatted('yyyy-mm-dd hh:mm{in}:ss')); $date = '5/29/09 11:20 PM Local Time'; $lsup->set_lsup($date); print sprintf("lsup '%s' -> %s local time\n",$date,$lsup->formatted('yyyy-mm-dd hh:mm{in}:ss')); $date = '5/29/09 11:59 PM Local Time'; $lsup->set_lsup($date); print sprintf("lsup '%s' -> %s local time\n",$date,$lsup->formatted('yyyy-mm-dd hh:mm{in}:ss')); $date = '5/29/09 0:20 AM Local Time'; $lsup->set_lsup($date); print sprintf("lsup '%s' -> %s local time\n",$date,$lsup->formatted('yyyy-mm-dd hh:mm{in}:ss')); $date = '5/29/09 12:20 AM Local Time'; $lsup->set_lsup($date); print sprintf("lsup '%s' -> %s local time\n",$date,$lsup->formatted('yyyy-mm-dd hh:mm{in}:ss')); $date = '5/29/09 12:20 PM Local Time'; $lsup->set_lsup($date); print sprintf("lsup '%s' -> %s local time\n",$date,$lsup->formatted('yyyy-mm-dd hh:mm{in}:ss'));
From: uwe.zimmermann [...] sciencetronics.com
Download (untitled) / with headers
text/plain 242b
Solution to above bug: in DateTime.pm sub set_lsup {} replace $hour += 12 if ( $ampm eq "PM" ); with if ($ampm eq "PM") { $hour += 12 if ($hour != 12); } else { $hour = 0 if ($hour = 12); }
From: uwe.zimmermann [...] sciencetronics.com
Download (untitled) / with headers
text/plain 135b
of course it should be: if ($ampm eq "PM") { $hour += 12 if ($hour != 12); } else { $hour = 0 if ($hour == 12); }


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.