> On Nov 2, 2019, at 7:08 AM, Fred Bone <fred.b...@dial.pipex.com> wrote:
> 
> On 01 November 2019 at 12:34, John Ralls said:
> 
> [...]
>> You could try adding this to fin.scm:
>> 
>> (load-from-path "gnucash/app-utils")
>> (define (gnc:days-in-prev-month) (/ ( + 1 (- (gnc:get-end-prev-month)
>> (gnc:get-start-prev-month)))) 86400))
> 
> This will produce a non-integer result if
> (a) prev month includes daylight-saving-time shift
> or
> (b) prev month includes a leap second.
> 
> (While I'm not familiar with Scheme, if the potential non-integer result 
> isn't an issue -- i.e. if it gets auto-rounded to nearest integer -- then 
> there was no point in adding the odd second).
> 

Time in GnuCash is UTC internally so there are no daylight-time changes. A leap 
second might be an issue, though a rather rare one.

See https://www.gnu.org/software/guile/manual/html_node/Exactness.html. Without 
adding the second back in the result of the division for October was 
2678399/86400. One could instead use 
  (round (/ (- (gnc:get-end-prev-month) (gnc:get-start-prev-month)))) 86400))
which would resolve the leap-second problem.

Regards,
John Ralls
_______________________________________________
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
If you are using Nabble or Gmane, please see 
https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.

Reply via email to