forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How To Wait/Pause?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
jgrimm



Joined: 29 Nov 2009
Posts: 27

PostPosted: Wed Dec 09, 2009 1:45 am    Post subject: How To Wait/Pause? Reply with quote

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
View user's profile Send private message MSN Messenger
cheriff
Regular


Joined: 23 Jun 2004
Posts: 262
Location: Sydney.au

PostPosted: Wed Dec 09, 2009 4:33 am    Post subject: Reply with quote

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
View user's profile Send private message
ragnarok2040



Joined: 09 Aug 2006
Posts: 230

PostPosted: Wed Dec 09, 2009 5:49 am    Post subject: Reply with quote

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
View user's profile Send private message
jgrimm



Joined: 29 Nov 2009
Posts: 27

PostPosted: Thu Dec 10, 2009 5:15 am    Post subject: Reply with quote

ok thx guys it doesnt need to be to be perfect i just need somthing that counts time :)
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group