View previous topic :: View next topic |
Author |
Message |
jgrimm
Joined: 29 Nov 2009 Posts: 27
|
Posted: Wed Dec 09, 2009 1:45 am Post subject: How To Wait/Pause? |
|
|
how do you pause program execution for an amount of time? what i need to do is like the BASIC sleep command, so pause 5 miliseconds is SLEEP 5. how do i do this in ps2sdk? thx |
|
Back to top |
|
|
cheriff Regular
Joined: 23 Jun 2004 Posts: 262 Location: Sydney.au
|
Posted: Wed Dec 09, 2009 4:33 am Post subject: |
|
|
ps2sdk contains a basic libc. The parts it implements, should be very similar to any other libc:
Code: | NAME
sleep -- suspend thread execution for an interval measured in seconds
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <unistd.h>
unsigned int
sleep(unsigned int seconds);
|
and, lo and behold: Code: | cheriff@lappy386:~/code/$ grep -R sleep ps2sdk/ee/libc/
ps2sdk/ee/libc/include/unistd.h:unsigned int sleep(unsigned int seconds);
|
_________________ Damn, I need a decent signature! |
|
Back to top |
|
|
ragnarok2040
Joined: 09 Aug 2006 Posts: 230
|
Posted: Wed Dec 09, 2009 5:49 am Post subject: |
|
|
There currently isn't anything in ps2sdk that's millisecond accurate except for clock(). You can just use CLOCKS_PER_SEC/1000 to calculate the amount of ticks per millisecond, or just define it as 576 using a macro, and compare to clock() until the period of time has passed. |
|
Back to top |
|
|
jgrimm
Joined: 29 Nov 2009 Posts: 27
|
Posted: Thu Dec 10, 2009 5:15 am Post subject: |
|
|
ok thx guys it doesnt need to be to be perfect i just need somthing that counts time :) |
|
Back to top |
|
|
|