Subject: | isoTime bug for minutes :00 through :09 in requests from gnucash |
The isoTime function in Quote.pm breaks quote retrieval in gnucash for
at least yahoo sources in US and Europe for times having minutes less
than 10. (Virtually every end-of-day quote in the US at least.)
If the Yahoo source sends a time value of "4:00pm" (with the quotes),
finance-quote sends 16:000 to gnucash. The gnucash parser then refuses
the quote as unusable.
sub isoTime {
my ($self,$timeString) = @_ ;
$timeString =~ tr/ //d ;
$timeString = uc $timeString ;
my $retTime = "00:00"; # return zero time if unparsable input
if ($timeString=~m/^(\d+)[\.:UH](\d+)(AM|PM)?/) {
my ($hours,$mins)= ($1,$2) ;
$hours+=12 if ($3 && ($3 eq "PM")) ;
if ($hours>=0 && $hours<=23 && $mins>=0 && $mins<=59 ) {
$retTime = $hours>=10 ? "$hours:" : "0$hours:" ;
$retTime.= $mins>=10 ? "$mins" :"0$mins" ;
}
If I change the "0$mins" to just "$mins" gnucash quits complaining, and
I can retrieve quotes again. Shouldn't that last line be:
$retTime.= "$mins" ;
?
or are there time sources that return things like 12H 3M ?