mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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
This commit is contained in:
parent
f6195c389b
commit
a881c3edf4
@ -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";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user