🎉 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?

Started by
2 comments, last by Kwizatz 22 years, 10 months ago
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.
Advertisement
Here''s how the SDL does it (gotta love open source):
  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!]
To add to the above - man gettimeofday.

saai
man 2 times

also check sysconf(_SC_CLK_TCK)
-------------------------------------------------------------LGPL 3D engine - http://www.sourceforge.net/projects/realityengine

This topic is closed to new replies.

Advertisement