ElapsedMilliseconds() PB 5.60 B8

Just starting out? Need help? Post your questions and find answers here.
Trion
New User
New User
Posts: 8
Joined: Tue Dec 27, 2016 11:13 pm

ElapsedMilliseconds() PB 5.60 B8

Post by Trion »

Debug ElapsedMilliseconds()

Return 0

Win 10 64 Bit PB 32 Bit
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 796
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: ElapsedMilliseconds() PB 5.60 B8

Post by Zebuddi123 »

Confirmed win 10 x64 tested all beta`s 8,7,6,5,4 all the same

Zebuddi.
malleo, caput, bang. Ego, comprehendunt in tempore
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: ElapsedMilliseconds() PB 5.60 B8

Post 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.
BERESHEIT
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: ElapsedMilliseconds() PB 5.60 B8

Post 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.
Last edited by Thunder93 on Wed Mar 01, 2017 4:51 am, edited 1 time in total.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: ElapsedMilliseconds() PB 5.60 B8

Post 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.
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: ElapsedMilliseconds() PB 5.60 B8

Post 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.
sorry for my bad english
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: ElapsedMilliseconds() PB 5.60 B8

Post 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
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: ElapsedMilliseconds() PB 5.60 B8

Post 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.
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ElapsedMilliseconds() PB 5.60 B8

Post by mk-soft »

What is with threads?
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: ElapsedMilliseconds() PB 5.60 B8

Post by Fred »

It's a global timer, so thread doesn't affect it.
User avatar
heartbone
Addict
Addict
Posts: 1058
Joined: Fri Apr 12, 2013 1:55 pm
Location: just outside of Ferguson

Re: ElapsedMilliseconds() PB 5.60 B8

Post 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.
Keep it BASIC.
Post Reply