SDL 1.3 Iphone clock_gettime

in SDL_systimer.c the iphon eport uses

clock_gettime(CLOCK_MONOTONIC, &start);

it’s a “posix realtime extensions” method ok…but I wonder why this should work for iphone. where this com from? I hope it?'s not from a private framework…so any iphone sdl apps would get rejected

This function is not available in OSX.

I know the iphone SDL port compiled this and uses this…not tested yet if the timing is ok…but it seems it’s ok.

BTW I uses this for monotonic clocks

unsigned long Clock_getTimeMs( void )
{
//best for OSX/iPhone
mach_timebase_info_data_t base;
mach_timebase_info(&base);
double toMs=((double)base.numer/(double)base.denom*1.0e-6);
curtime=mach_absolute_time()*toMs;
return curtime;
}–
Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/chbrowser

well the iphone has a complete set of unix system calls available, so i’d
not be surprised it were working
then again, i’ve never tested that syscall so i’m ready to be contradicted
:slight_smile:
VittorioOn Thu, Mar 25, 2010 at 4:41 PM, hermann jakobi wrote:

in SDL_systimer.c the iphon eport uses

clock_gettime(CLOCK_MONOTONIC, &start);

it’s a “posix realtime extensions” method ok…but I wonder why this
should work for iphone. where this com from? I hope it?'s not from a private
framework…so any iphone sdl apps would get rejected

This function is not available in OSX.

I know the iphone SDL port compiled this and uses this…not tested yet if
the timing is ok…but it seems it’s ok.

BTW I uses this for monotonic clocks

unsigned long Clock_getTimeMs( void )
{
//best for OSX/iPhone
mach_timebase_info_data_t base;
mach_timebase_info(&base);
double toMs=((double)base.numer/(double)base.denom*1.0e-6);
curtime=mach_absolute_time()*toMs;
return curtime;
}

Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/chbrowser


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

clock_gettime is a UNIX function.
There should be no problem with using it on iPhone, or OS X for that matter.------------------------
EM3 Nathaniel Fries, U.S. Navy