portal64-still-alive icon indicating copy to clipboard operation
portal64-still-alive copied to clipboard

Decouple time interface from libultra

Open GiacomoGarbin opened this issue 9 months ago • 5 comments

We can replace libultra's OSTime with a typedef ... Time which can be library-dependent or library-independent, in which case each library implementation can define functions to convert to/from its internal time format.

Then we can add to the time interface a gettime function to get the now time and a difftime function to compute the difference of two times.

There is nothing more to add beyond what @mwpenny suggested about OSTimer in https://github.com/mwpenny/portal64-still-alive/pull/47#issuecomment-2076240521:

Note that the game's OSTimer usage is only for creating a delay - it is effectively just an asynchronous sleep() and can be wrapped as such

We can add to the time interface a sleep function which causes the calling thread to sleep until the seconds specified have elapsed.

GiacomoGarbin avatar May 07 '24 23:05 GiacomoGarbin