Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Ticks as a floating point value on XP (not 2000)


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-08-2008, 12:16 PM
Newbie
 
Join Date: Feb 2008
Location: Worcestershire, UK
Posts: 7
Question Ticks as a floating point value on XP (not 2000)

I have a desktop application that saves a ticks value into a column in a table control (and also into a column value in a SQL Lite database).

I then use this value when filtering records.

On Windows 2000, the TicksColumn value is reported as an 18 digit string (as expected) however on XP the value is reported as a floating point value (e.g. 6.33432093 E+17). A simple MsgBox is used to determine this.

Now when I compose a SQLlite Select statement with

"... WHERE TicksColumm > '" & Calendar1.value & "'" the select doesn't return the expected records on XP but works as expected on Win 2000.

Any ideas where the difference is introduced?

Do I need set the TickColumn value with Format(Now,"D18") to ensure it is always held as a string?

Are there other known gotchas with desktop apps on different platforms?

T.I.A.
Dave Lancaster
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 08:29 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

Try to remove the apostrophes from your query. They are only needed with strings.
I don't know how to explain the difference between the two computers.
Here on XP it shows the ticks as an 18 digits number.
Reply With Quote
  #3 (permalink)  
Old 04-09-2008, 11:11 AM
Newbie
 
Join Date: Feb 2008
Location: Worcestershire, UK
Posts: 7
Default

Erel,
Thanks for reply. Have tried without apostrophies with no change.

However I can now exlude any platform differences.

I have proven with the enclosed test program that

DateFormat("dd/mm/yyyy")
MsgBox DateParse("13/04/2008")

returns 633436416000 on Windows 2000 and XP when run interpretively under B4PPC.

however it returns 6.33436416E+17 on Windows 2000 & XP when run as a compiled executable.

The net result is that my application works 100% under B4PPC but not once it is compiled.

Any further suggestions gratefully received.

Dave Lancaster
Attached Files
File Type: sbp DateParseTest.sbp (537 Bytes, 2 views)
Reply With Quote
  #4 (permalink)  
Old 04-09-2008, 11:22 AM
Senior Member
 
Join Date: Apr 2007
Location: Copenhagen
Posts: 143
Default

Seems to have something to do with the type of compilation

Using XP and a non-optimized compiled version I get 633436416000,
but when using an optimized compilation I end up with 6.33436416E+17

all the best / Björn
Reply With Quote
  #5 (permalink)  
Old 04-09-2008, 11:38 AM
Newbie
 
Join Date: Feb 2008
Location: Worcestershire, UK
Posts: 7
Default

Erel, Bjorn,

The brain is now in gear ... and it is to do with the way that the result from DateParse() is cast by the machine.

I now get the exponential form of response if I use int(dateparse("13/04/2008")) both as an executable and under B4PPC.

Therefore I can now force my application to always use exponential tick values (floating point integers - what's that all about then?).

So, the fix to the problem is

1) Use int() to force the result to be cast as E+nn format
2) Use Erel's original suggestion of dropping apostrophes from SQLlite SELECT statement to make sure value is always treated as numeric. (I suspect it was performing a string comparison before).

One for the knowledgebase I think.

Thanks.

Dave Lancaster
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting date to ticks value mozaharul Questions & Help Needed 3 10-22-2008 10:51 AM
Fixed Point Math im4retro Questions & Help Needed 3 05-31-2008 07:13 AM
3 Point Arc ceaser Questions & Help Needed 38 05-27-2008 04:23 PM
Ticks truncated on the device? willisgt Questions & Help Needed 1 12-11-2007 06:29 PM
Ticks, 1000000 in a second? colin9876 Bug Reports 6 12-09-2007 02:40 PM


All times are GMT. The time now is 01:47 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0