Page 1 of 1

ElapsedMilliseconds() PB 5.60 B8

Posted: Wed Mar 01, 2017 1:01 am
by Trion
Debug ElapsedMilliseconds()

Return 0

Win 10 64 Bit PB 32 Bit

Re: ElapsedMilliseconds() PB 5.60 B8

Posted: Wed Mar 01, 2017 1:22 am
by Zebuddi123
Confirmed win 10 x64 tested all beta`s 8,7,6,5,4 all the same

Zebuddi.

Re: ElapsedMilliseconds() PB 5.60 B8

Posted: Wed Mar 01, 2017 2:21 am
by netmaestro
That might actually not be a bug. It's possible that the first call to ElapsedMilliseconds() starts the count from 0:

Code: Select all

Debug ElapsedMilliseconds() ; 0
Delay(800)
Debug ElapsedMilliseconds() ; 800
Or maybe it is. Fred will say.

Re: ElapsedMilliseconds() PB 5.60 B8

Posted: Wed Mar 01, 2017 3:53 am
by Thunder93
netmaestro I believe is correct. With PB 5.60 Beta 8, it starts with 0, with PB 5.44LTS it doesn't. With LTS, it seems to be unreliable at times. With PB 5.60 Beta 8, it seems spot on every time.

Code: Select all

StartTime = ElapsedMilliseconds()             ; Get the actual value
Debug StartTime
Delay(1000)                                   ; Wait 1000 milliseconds
ElapsedTime = ElapsedMilliseconds()-StartTime
Debug ElapsedTime
Debug "----"
With PureBasic 5.60 Beta 8
0
1000
----

With PureBasic 5.44LTS
230004685
1000
----

however it often shows instead 1001 with 5.44LTS. Also, 230004685 isn't constant set of numbers.

Re: ElapsedMilliseconds() PB 5.60 B8

Posted: Wed Mar 01, 2017 4:35 am
by Dude
Not a bug, because the manual specifically says:
PureBasic manual wrote:this function should be used to calculate time differences between multiple ElapsedMilliseconds() calls
So calling it once is naturally going to return 0.

Re: ElapsedMilliseconds() PB 5.60 B8

Posted: Wed Mar 01, 2017 5:03 am
by Josh
I am sure it is by design, because the new underlying API would require a quad and that would lead to errors in many old codes.

Dude wrote:So calling it once is naturally going to return 0.
A difference is calculated of two numbers and has nothing to do with 0.

Re: ElapsedMilliseconds() PB 5.60 B8

Posted: Wed Mar 01, 2017 6:31 am
by nco2k
yea its not a bug. its a design change.

it looks like now the initial value gets set on the first call of ElapsedMilliseconds(). why not at program start though? would be more logical imho.

c ya,
nco2k

Re: ElapsedMilliseconds() PB 5.60 B8

Posted: Wed Mar 01, 2017 7:55 am
by Fred
It was already like this on OSX and Linux, so I just did the same on Windows. ElapsedMilliseconds() is not from program start, it's between 2 call of it.

Re: ElapsedMilliseconds() PB 5.60 B8

Posted: Sat Mar 04, 2017 9:47 am
by mk-soft
What is with threads?

Re: ElapsedMilliseconds() PB 5.60 B8

Posted: Sat Mar 04, 2017 12:21 pm
by Fred
It's a global timer, so thread doesn't affect it.

Re: ElapsedMilliseconds() PB 5.60 B8

Posted: Sat Mar 04, 2017 3:32 pm
by heartbone
Fred wrote:It was already like this on OSX and Linux, so I just did the same on Windows. ElapsedMilliseconds() is not from program start, it's between 2 call of it.
Fred, if our world was fair, and technical expertise was given similar value to musical and vocal expertise,
then you would likely be a very wealthy man, close to the Paul McCartney level.
I hope things change.
Thanks, and peace.