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 

GetTickCount equilivent?

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



Joined: 26 Jun 2006
Posts: 275

PostPosted: Thu Jul 13, 2006 3:34 am    Post subject: GetTickCount equilivent? Reply with quote

Hi,

Is there a psp sdk version of getTickcount or similar function that I can use to build my timer class?
Back to top
View user's profile Send private message
zilt



Joined: 21 Feb 2006
Posts: 45
Location: Ontario, Canada

PostPosted: Thu Jul 13, 2006 3:43 am    Post subject: Reply with quote

Are you unable to do even the most basic searching of the psp include files? Try grepping for 'tick' in the psp include files directory. You might even find a function you're looking for.
_________________
"We are dreamers, shapers, singers, and makers. We study the mysteries of laser and circuit, crystal and scanner, holographic demons and invocations of equations. These are the tools we employ and we know... many things." -- Elric, B5
Back to top
View user's profile Send private message Visit poster's website
siberianstar



Joined: 22 Jun 2006
Posts: 70

PostPosted: Thu Jul 13, 2006 3:44 am    Post subject: Reply with quote

Code:
int gettick() {
   static timeval tv;
   gettimeofday(&tv, 0);
   return (int)(tv.tv_sec * 1000) + (tv.tv_usec / 1000);
}


include sys/time.h
Back to top
View user's profile Send private message
Kojima



Joined: 26 Jun 2006
Posts: 275

PostPosted: Thu Jul 13, 2006 4:00 am    Post subject: Reply with quote

Thanks Sib.

Zlit, in the words of a great man. "I dunno"
Back to top
View user's profile Send private message
sg57



Joined: 14 Oct 2005
Posts: 154

PostPosted: Thu Jul 13, 2006 5:49 am    Post subject: Reply with quote

I just made my own little GetTickCount function for when i was porting a Quake II MD2 Model loader to PSPGL instead of OpenGL.

I had something like:
Code:

int GetTickCount() {
     return time()/1000;
}

Since the 'time' function returns the current second from that clock at GNU or where ever it said, i divided it by 1000 to get it into miliseconds as the key frame required it.

Oh and im just wondering if that would work. I was too lazy to go searching.
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Thu Jul 13, 2006 6:12 am    Post subject: Reply with quote

Nope, not even close. Taking a second based timer and dividing it by 1000 gives you kiloseconds not milliseconds :)

Seeing as you obviously dont know how to use grep :P

#include <psprtc.h>

u64 tick;
u64 millis;

sceRtcGetCurrentTick(&tick)
millis = tick / ((u64) sceRtcGetTickResolution() / 1000);
Back to top
View user's profile Send private message
Edorul



Joined: 27 May 2006
Posts: 7
Location: France

PostPosted: Thu Jul 13, 2006 6:17 am    Post subject: Reply with quote

If you want you can use this function: int sceRtcGetCurrentTick(u64 *tick);
defined in "psprtc.h". It returns a time in microseconds.

Here is a sample how to use it:

Code:

#include <psprtc.h>

//return time in milliseconds
u64 GetTick()
{
     u64 temp;
     sceRtcGetCurrentTick(&temp);
     return temp/1000;
}

void main()
{
     u64 tick;
     tick = GetTick();
}



edit : "bis repetita placent"... TyRaNiD and I have posted nearly the same post at the same moment! :D
Back to top
View user's profile Send private message Visit poster's website
Kojima



Joined: 26 Jun 2006
Posts: 275

PostPosted: Thu Jul 13, 2006 6:47 am    Post subject: Reply with quote

Lol thanks guys. As for grep, I thought that was a kind of grape until two days ago so don't blame me. :)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP 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