Trying to port some nasty demo, source of which i got from the authors, and while i already remove Cocoa and Fmod parts (replaced it by SDL/OpenGl/Sdl_mixer), i have stuck a bit on such lame/little fucntion:
I suck with all of this, working function will be awesome :) Maybe it possible just get current system time by some aos4/posix function, then again and delta = starttime - endtime , or kind of.
You should be able to implement some kind of AbsoluteDeltaToDuration() function from this, if you combine it whit the TimeVal_to_float() and float_to_TimeVal() functions.
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
It would be easy if only we knew what the original is supposed to do. Is it returning the current time, the time since the system was turned on, or what?
It would be easy if only we knew what the original is supposed to do. Is it returning the current time, the time since the system was turned on, or what?
That function should calculate FPS (and return a Float value)
That what i found in net (in the macos docs).
Uptime() and AbsoluteTime data structure
Quote:
The function UpTime() returns the amount of elapsed time since the computer started up. It returns the elapsed time in an AbsoluteTime data structure, which is a 64-bit integer. You can’t directly do anything with the AbsoluteTime data structure. You must use one of the two conversion functions Apple supplies. The first function is AbsoluteToDuration(), which tells you the number of milliseconds (1000 milliseconds = 1 second) that elapsed since the computer was turned on. The advantage of using the Duration data structure is that the structure is a 32-bit integer. You don’t have to convert it to a double. For games millisecond accuracy is usually sufficient.
AbsoluteDeltaToDuration
Quote:
Subtracts one absolute time from another and returns the difference as a duration value.
Is the "gStartTime" initialised somewhere? When the program starts, perhaps? Or is it merely loaded with zero and counted as an "UpTime"?
Do you really need a result in FPS, or is it something you will calculate later?
If you just want a result that is the UpTime(), that is easily read from ITimer->GetUpTime(). But you have to open the Timer device beforehand. I can give you some example code if you like, but you'll have to call an Init function when your program starts (and before timeGetTime() is called).
gStartTime initialized only for that fucntion, like i show in first post:
AbsoluteTime gStartTime;
(where AbsoluteTime its just data structure, but cant found what exactly it have inside, its in core sources of macos).
Quote:
Do you really need a result in FPS, or is it something you will calculate later?
Its not that i need it very much, its just done like that in the demo (not my), which heavy based on it. So, i just should rewrite it to aos4, to make return float DeltaTime (ie the same input, the same output, but different inside, just to make it works the same by logic). Because rewiritng the whole demo timing-fps-part related (which done not by me) its much harder if just rewrite one function.
As i point in the first port, its just static int fucntion, without any input, its just calcualte FPS speed, and then, return Float value (deltaTime), which are used by whole demo in all the effects.
Quote:
If you just want a result that is the UpTime(), that is easily read from ITimer->GetUpTime(). But you have to open the Timer device beforehand. I can give you some example code if you like, but you'll have to call an Init function when your program starts (and before timeGetTime() is called).
All what i need its just working replacement fucntion, just because a trying to works on other project right now, and will be cool, if someone can just write me ready-to-use fucntion, which have no input (static void), and return float DeltaTime. Which i can just put inside the code, and recompile the demo. I can of course start to read documenations, docs, ask on other forums, but that will take time (which i can spend on more important aos4-related stuff), and for sure will be better if someone who know about all of this already, can just write ready-to-insert function.