src/timer/psp/SDL_systimer.c
changeset 7191 75360622e65f
parent 7009 161b7b6a5303
child 7649 4f801cd08f3f
equal deleted inserted replaced
7190:11612d544fcd 7191:75360622e65f
    30 
    30 
    31 static struct timeval start;
    31 static struct timeval start;
    32 
    32 
    33 void SDL_StartTicks(void)
    33 void SDL_StartTicks(void)
    34 {
    34 {
    35 	gettimeofday(&start, NULL);
    35     gettimeofday(&start, NULL);
    36 }
    36 }
    37 
    37 
    38 Uint32 SDL_GetTicks(void)
    38 Uint32 SDL_GetTicks(void)
    39 {
    39 {
    40 	struct timeval now;
    40     struct timeval now;
    41 	Uint32 ticks;
    41     Uint32 ticks;
    42 
    42 
    43 	gettimeofday(&now, NULL);
    43     gettimeofday(&now, NULL);
    44 	ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000;
    44     ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000;
    45 	return(ticks);
    45     return(ticks);
    46 }
    46 }
    47 
    47 
    48 Uint64
    48 Uint64
    49 SDL_GetPerformanceCounter(void)
    49 SDL_GetPerformanceCounter(void)
    50 {
    50 {
    57     return 1000;
    57     return 1000;
    58 }
    58 }
    59 
    59 
    60 void SDL_Delay(Uint32 ms)
    60 void SDL_Delay(Uint32 ms)
    61 {
    61 {
    62 	const Uint32 max_delay = 0xffffffffUL / 1000;
    62     const Uint32 max_delay = 0xffffffffUL / 1000;
    63 	if(ms > max_delay)
    63     if(ms > max_delay)
    64 		ms = max_delay;
    64         ms = max_delay;
    65 	sceKernelDelayThreadCB(ms * 1000);
    65     sceKernelDelayThreadCB(ms * 1000);
    66 }
    66 }
    67 
    67 
    68 /* vim: ts=4 sw=4
    68 /* vim: ts=4 sw=4
    69  */
    69  */