[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: Bug #76679
From: Thomas Zander <zander () kde ! org>
Date: 2004-07-18 19:07:17
Message-ID: 200407182107.22041.zander () kde ! org
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Isnt there a QRound that does the 0.5 addition or something?
On Sunday 18 July 2004 14:27, Ariya Hidayat wrote:
> > I've had a quick look - you can see strOutText and strText being set
> > in the tryParseTime() function.
> > It might be a matter of looking in kdelibs/kdecore/klocale.[cpp,h] as
> > well, to make sure the transition from string to QDate is being
> > handled correctly.
>
> There's precision problem because of division and multiplication with
> 86400. The following patch fixes the problem. Please check.
>
> Index: kspread_value.cc
> ===================================================================
> RCS file: /home/kde/koffice/kspread/kspread_value.cc,v
> retrieving revision 1.12
> diff -u -p -r1.12 kspread_value.cc
> --- kspread_value.cc 10 Jul 2004 12:52:07 -0000 1.12
> +++ kspread_value.cc 18 Jul 2004 12:18:56 -0000
> @@ -337,7 +337,7 @@ QDateTime KSpreadValue::asDateTime() con
> QDateTime dt = QDate( 1899, 12, 31 );
>
> double f = asFloat();
> - dt = dt.addSecs( (f-(int)f) * 86400 );
> + dt = dt.addSecs( 0.5 + (f-(int)f) * 86400 );
> if( f > 1.0 ) dt = dt.addDays( (int) f-1 );
>
> return dt;
> @@ -360,7 +360,7 @@ QTime KSpreadValue::asTime() const
> QTime dt;
>
> double f = asFloat();
> - dt = dt.addSecs( (f-(int)f) * 86400 );
> + dt = dt.addSecs( 0.5 + (f-(int)f) * 86400 );
>
> return dt;
> }
> _______________________________________________
> koffice-devel mailing list
> koffice-devel@mail.kde.org
> https://mail.kde.org/mailman/listinfo/koffice-devel
- --
Thomas Zander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFA+sppCojCW6H2z/QRAls5AJ4ib25fF/Fv/bXQDl5s03eFwK1YYwCfcPp/
aWSs+uxkYyiEXqggAXePs8s=
=OVii
-----END PGP SIGNATURE-----
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic