GNOME Bugzilla – Bug 361604
Balance sheet report shows incorrect prices for commodities when using "nearest in time" option
Last modified: 2018-06-29 21:13:38 UTC
The "nearest time" option on the "commodities" tab of the balance sheet report does not work correctly when trying to print a *historical* balance sheet. The balance sheet keeps using the most recent prices of all commodities (e.g., stocks, bonds, etc.) instead of the prices closest to the report date. This is a major bug as it directly affects the creation of accurate historical balance sheets.
Can you please provide a (simple) example file to demonstrate this error, and attach it here (as "attachment")? So far we haven't heard of any problems with the "nearest in time" option.
Created attachment 74881 [details] Sample gnucash file (gzip archive)
The above attachment is a simple gnucash file which has a single investment with a price history. The balance sheet is dated as of 2006.06.30 and is set to use "nearest in time" prices for commodities, but it doesn't show the right prices as of 2006.06.30.
I just realized that the balance sheet report is not saved in the data file itself but in the logs, so you will have to run a balance sheet report on the above file. Use 2006.06.30 as the date of the report, and select "nearest in time" prices for commodities, and you will see the bug. Thanks for taking the time to read this and help out :-)
I also noticed this error. Carl van Denzen
*** Bug 395694 has been marked as a duplicate of this bug. ***
Created attachment 92428 [details] [review] Patch to fix this problem The change to lib/libqof/qof/gnc-date.h in revision 13747 changed the type of the tv_sec member of timespec64 (and hence Timespec) from long long to guint64. Since Timespecs are used to hold time differences (which can be negative) as well as time values, this was a bad idea. One observable effect of this is that the "nearest in time" price lookup always returns the later of the two prices that bracket the time in question even if the earlier one is nearer. The test file attached to this bug has price quotes for 2006.06.30 and 2006.07.31 (both at midnight). It also has later quotes, but they don't matter for this example. The report date is 2006.06.30 (at noon) so it's between these two quotes, but it uses the July quote even though it's closer to the June quote. This patch fixes this by changing tv_sec to gint64.
r16370, 2.2.1. Thanks for the patch!
I tried to apply the patch (that succeeded I think). But the problem is not solved. Maybe I did something wrong (I used Fink, Apple OSX). Is there anyone who can confirm that the problem has been resolved with this patch? Thank you.
(In reply to comment #8) > r16370, 2.2.1. Thanks for the patch! > Did you verify that the solution fixed the problem? I am still having the same problem. Carl.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=361604. Please update any external references or bookmarks.