Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,791 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Strange behavior from total_secs #151099
08/30/07 03:04
08/30/07 03:04
Joined: Aug 2005
Posts: 10
bconyne Offline OP
Newbie
bconyne  Offline OP
Newbie

Joined: Aug 2005
Posts: 10
Here is a little 3-line code snippet that does not behave the way I would expect it to. This doesn't mean I'm not at fault, but I just don't see why it should behave like this.

// (normal headers go here)

var end_time;

function main()
{
wait(-1);
wait(-1);
end_time = total_secs;
} // place a breakpoint here...

So I add a watch for "end_time" and set a breakpoint on the last line of the program - the closing brace (see comment). Then I run the program in debug mode - end_time will either be 3.0 or 4.0 seconds, but never 2.0 as I would expect.

You might think that this is because of setup time or debug overhead, but if you comment out one of the "wait(-1);" statements, end_time is always 1.0. In 30 or 40 runs I never saw a different number.

Can anyone explain this?

Thanks,
--BobC

Re: Strange behavior from total_secs [Re: bconyne] #151100
08/31/07 06:17
08/31/07 06:17
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
I guess the reason is that a lot of stuff is happening in the first frame, like opening the window and initialization of the DirectX device. This can take longer than a second and adds to the time spent by the two wait calls.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1