![](smile.gif)
🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
timeGetTime? GetTickCount?
Hello guys!
Well, after posting to that Win XP Thread
(you all know which one I hope), I decided to do start on porting what I have of my game so far from Windows to Linux (the idea is to have both versions at the same time by developing both at the same time).
Anyway, I found a problem, and that is, there seems to be no timeGetTime or GetTickCount function in linux, I mean, sure there must be one, but is not called eighter one of those names, does anyone know what the function is? I have tried the manual (man) with no results, any help will be apressiated
Thanks.
![](smile.gif)
Here''s how the SDL does it (gotta love open source):
Just rewrite that for yourself (i.e. remove the SDL stuff, et cetera). You should include the following: sys/time.h and unistd.h. I''m not sure if you need to link to any libraries, but I''d guess that you probably don''t.
[Resist Windows XP''s Invasive Production Activation Technology!]
static struct timeval start;void SDL_StartTicks(void){ /* Set first ticks value */ gettimeofday(&start, NULL);}Uint32 SDL_GetTicks (void){ struct timeval now; Uint32 ticks; gettimeofday(&now, NULL); ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000; return(ticks);}
Just rewrite that for yourself (i.e. remove the SDL stuff, et cetera). You should include the following: sys/time.h and unistd.h. I''m not sure if you need to link to any libraries, but I''d guess that you probably don''t.
[Resist Windows XP''s Invasive Production Activation Technology!]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement