Datetime values from ole

This is a discussion on Datetime values from ole within the xharbour forums in Programming Languages category; Dear developers, There is changelog entry: >2008-07-25 13:15 UTC+0100 Jose F. Gimenez <jfgimenez/at/wanadoo.es> > * source/rtl/dateshb.c > + function TTOD( <datetime> ) -> <dateonly> > * source/rtl/win32ole.prg > % Allow a pointer passed to TOleAuto():New(), treating it as a pointer to idispatch, > just like in case of numeric > % Avoid precision faults in reading datetime values from ole and in win32ole.prg module after call to hb_itemPutDTD there is lines pItem->item.asDate.time++; I suppose instead of this in module source\common\hbdate.c function hb_datetimeUnpack() change lines dTime *= (double)(86400 * HB_DATETIMEINSEC); *plTime = (LONG)dTime; to dTime *= (double)(86400 * HB_DATETIMEINSEC); *plTime = ...

Go Back   Application Development Forum > Programming Languages > xharbour

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-14-2008, 07:51 AM
Saulius
Guest
 
Default Datetime values from ole

Dear developers,

There is changelog entry:

>2008-07-25 13:15 UTC+0100 Jose F. Gimenez <jfgimenez/at/wanadoo.es>
> * source/rtl/dateshb.c
> + function TTOD( <datetime> ) -> <dateonly>
> * source/rtl/win32ole.prg
> % Allow a pointer passed to TOleAuto():New(), treating it as a pointer to idispatch,
> just like in case of numeric
> % Avoid precision faults in reading datetime values from ole


and in win32ole.prg module after call to hb_itemPutDTD there is lines

pItem->item.asDate.time++;

I suppose instead of this in module source\common\hbdate.c
function hb_datetimeUnpack() change lines

dTime *= (double)(86400 * HB_DATETIMEINSEC);
*plTime = (LONG)dTime;

to

dTime *= (double)(86400 * HB_DATETIMEINSEC);
*plTime = (LONG)(dTime + 0.5);

to force rounding double values to long (not truncating).
This solves precision faults problems after floating point operations.

Best regards,
Saulius


Reply With Quote
  #2  
Old 08-14-2008, 07:32 PM
Rick Lipkin
Guest
 
Default Re: Datetime values from ole

Saulius

This simple sting works just fine for me :

oRs:Fields("lastlogDt"):Value := dtoc(DATE())+" "+time()

Rick Lipkin


On Aug 14, 7:51*am, "Saulius" <Saul...@NOSPAM.com> wrote:
> Dear developers,
>
> There is changelog entry:
>
> >2008-07-25 13:15 UTC+0100 Jose F. Gimenez <jfgimenez/at/wanadoo.es>
> > ** source/rtl/dateshb.c
> > * *+ function TTOD( <datetime> ) -> <dateonly>
> > ** source/rtl/win32ole.prg
> > * *% Allow a pointer passed to TOleAuto():New(), treating it as a pointer to idispatch,
> > * * *just like in case of numeric
> > * *% Avoid precision faults in reading datetime values from ole

>
> and in win32ole.prg module after call to hb_itemPutDTD there is lines
>
> * * * pItem->item.asDate.time++;
>
> I suppose instead of this in module source\common\hbdate.c
> function hb_datetimeUnpack() change lines
>
> * * * dTime **= (double)(86400 * HB_DATETIMEINSEC);
> * * * *plTime = (LONG)dTime;
>
> to
>
> * * * dTime **= (double)(86400 * HB_DATETIMEINSEC);
> * * * *plTime = (LONG)(dTime + 0.5);
>
> to force rounding double values to long (not truncating).
> This solves precision faults problems after floating point operations.
>
> Best regards,
> Saulius


Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 04:57 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.