After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 631242 - go_date_days_between_basis problem
go_date_days_between_basis problem
Status: RESOLVED FIXED
Product: libgoffice
Classification: Other
Component: General
0.8.x
Other Linux
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks: 630784
 
 
Reported: 2010-10-03 17:29 UTC by Andreas J. Guelzow
Modified: 2010-10-03 18:14 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Andreas J. Guelzow 2010-10-03 17:29:19 UTC
A minor issue is the comment:
 * returns    : Number of days strictly between from and to +1

in the first switch case if *from==*to 0 is returned so the comment can't be right. Note that the usage of this function depends on 0 being returned for *to==*from
------------------------------------------
The following problem is serious:
Breakpoint 1, yearfrac (from=0xbfffdd80, to=0xbfffdd78, 
    basis=GO_BASIS_MSRB_30_360) at gnm-datetime.c:158
158		if (!g_date_valid (from) || !g_date_valid (to))
(gdb) n
161		days = go_date_days_between_basis (from, to, basis);
(gdb) 
163		if (days < 0) {
(gdb) p days
$7 = -2
(gdb) p *from
$8 = {julian_days = 733831, julian = 1, dmy = 1, day = 28, month = 2, 
  year = 2010}
(gdb) p *to
$9 = {julian_days = 733831, julian = 1, dmy = 1, day = 28, month = 2, 
  year = 2010}
(gdb) c
Continuing.

Note that *from==*to so the return value ought to be 0 but is -2!

This bug underlies the first issue in bug 630784.
Comment 1 Andreas J. Guelzow 2010-10-03 18:14:03 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.