Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ISSUE:datetime field/memory conversion
Message
From
19/10/2005 13:53:22
 
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro Beta
Title:
ISSUE:datetime field/memory conversion
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01060386
Message ID:
01060386
Views:
50
Expected:
1. the VFP datetime written in a field datetime should have 0 milliseconds
2. rewrite a field with the value of the same field
it should not change the value of it.

observed:
1. when a datetime value is written into a field,
VFP doesn't effect the rounding and the conversion
from float to integer it produces an error of some ms.

2. the absence of the rounding determines a variation of the tt datetime field value
when
replace tt WITH tt
it is done.

Repro:
CLOSE TABLES ALL
CLEAR
CREATE TABLE dttable FREE (tt t)
APPEND BLANK
USE

USE dttable shared

#DEFINE ttposition  362


?  "Read write difference"
?? "Field julian day part"	AT 30
?? "Field date part"		AT 60
?? "Field time part"		AT 80
TTREAD = DATETIME(2000,1,1,0,0,15)
REPLACE tt  WITH DATETIME(2000,1,1,0,0,15)


* convert the TT into the float format = julianday.dayfraction
FOR k=1 TO 5

	FLUSH FORCE
	
	* read the field datetime
	TTRAW=SUBSTR(FILETOSTR(DBF()),ttposition,8)
	* print
	?  PADL((m.TTREAD - TT)*1.000000000000000,20)
	?? CTOBIN(LEFT(m.TTRAW,4),"RS") 	AT 30
	?? SYS(10,CTOBIN(LEFT(m.TTRAW,4),"RS"))	AT 60
	?? CTOBIN(RIGHT(m.TTRAW,4),"RS")*0.001	AT 80
	
	* convert the field in floating point memory
	TTREAD = TT
	* rewrite the field change the value
	replace tt WITH tt
NEXT

USE
ERASE dttable.dbf
Reply
Map
View

Click here to load this message in the networking platform