Seconds() in Core rounding to Centisecond, not Millisecond ? Why round at all ?

This forum is meant for questions and discussions about the X# language and tools
Post Reply
mainhatten
Posts: 200
Joined: Wed Oct 09, 2019 6:51 pm

Seconds() in Core rounding to Centisecond, not Millisecond ? Why round at all ?

Post by mainhatten »

nor really breaking anything, but at least vfp is documented to count milliseconds since midnight and does that on Win7/64 - older 32 were not that granular, there I would not have realized it.

I see no real(8) reason to round to 2 or 3 decimal places - if there is a problem in VN or VO, such rounding should happen there, but overwriting seconds() just for vfp runtime to get higher accuracy for simple measurements would not be a problem - it just feels "misplaced". Or have I misread something ?

And yes, for really working on timing issues Dotnet offers not only TickCount, but seems to have wrapped QueryPerf-Api already in Stopwatch (perhaps too much - saving and manipulating 8Byte counters and then converting feels better.

regards
thomas
User avatar
Chris
Posts: 4922
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Seconds() in Core rounding to Centisecond, not Millisecond ? Why round at all ?

Post by Chris »

Hi Thomas,

Yes, indeed, VO uses 2 decimal places for this function, for this reason it is implemented like that in X# as well. I think it will be no issue making it return 3 decimals for the VFP dialect, will log this. The VFP version does always show 3 decimals, is that right?
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
mainhatten
Posts: 200
Joined: Wed Oct 09, 2019 6:51 pm

Seconds() in Core rounding to Centisecond, not Millisecond ? Why round at all ?

Post by mainhatten »

Chris wrote:Yes, indeed, VO uses 2 decimal places for this function, for this reason it is implemented like that in X# as well. I think it will be no issue making it return 3 decimals for the VFP dialect, will log this. The VFP version does always show 3 decimals, is that right?
Hi Chris,
quick test on Win7/64 and XP/32 both show 3 decimal places, multiplying with 10000 always leaves 0 as last char: so vfp rounds to 3 digits at least on those OS.

regards
thomas
mainhatten
Posts: 200
Joined: Wed Oct 09, 2019 6:51 pm

Seconds() in Core rounding to Centisecond, not Millisecond ? Why round at all ?

Post by mainhatten »

Chris wrote: I think it will be no issue making it return 3 decimals for the VFP dialect, will log this.
rethinking I still believe "more capable" milliseconds version should be in Core, Centiseconds in VN/VO assemblies.
Benefits: usual behaviour in VO/VN as before, but those wishing for higher accuracy while coding in VO/VN can call Core.seconds without delivering more assemblies. Those programming by intent to core, as Wolfgang demonstrates, get better seconds() result, as they also want to be unencumbered by VN/VO Usuals and stuff.

More text than this measly function warrants ;-))

regards
thomas
User avatar
Chris
Posts: 4922
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Seconds() in Core rounding to Centisecond, not Millisecond ? Why round at all ?

Post by Chris »

Hi Thomas,

I personally think there's no point making things so complicated. For core, IMO the best option is to just use the .Net classes directly, each user handling them the way that's best suited to them. With DateTime.Now you can get the current date and time and manipulate it in any way that suits!
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply