From a881c3edf438af1227e011d78afea55b1135627d Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Sun, 17 Jan 2010 21:26:48 +0000 Subject: [PATCH] Bug #607185: Add f-q workaround for missing date. Patch by "meo": If for whatever reason finance-quote is unable to get a date for a quote or to convert it to the standardized form, gnucash is unable to use the otherwise correct quote. With web pages being updated definitively more frequently than finance-quote, this is quite a nuisance. Up to now, gnc-fq-helper emits an error message + the quote, a combination gnucash is unable to process. This patch presents a workaround. I would prefer using the current date + 12 hours rather than current date + time, but this is open for discussion. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18575 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/quotes/gnc-fq-helper.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/quotes/gnc-fq-helper.in b/src/quotes/gnc-fq-helper.in index 75d0adc2b1..bff6c55d62 100644 --- a/src/quotes/gnc-fq-helper.in +++ b/src/quotes/gnc-fq-helper.in @@ -219,6 +219,12 @@ sub get_quote_time { $parsestr = ParseDateString($parsestr); my $result = UnixDate($parsestr, "\"%Y-%m-%d %H:%M:%S\""); + if(!$result) { + # Fix date handling for quotes with no date: assume local date + (my $second,my $minute,my $hour,my $dayofmonth,my $month,my $year,my $dayofweek,my $dayofyear,my $daylightsaving) = localtime(); +# $result = "\"".sprintf("%04d-%02d-%02d%02d:%02d:%02d",($year+1900),++$month,$dayOfMonth,$hour,$minute,$second)."\""; + $result = "\"" . sprintf("%04d-%02d-%02d", ($year+1900), ++$month, $dayofmonth) . " 12:00:00\""; + } if($result !~ /^\"\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\"$/) { $result = "failed-conversion"; }