LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-05-2005, 02:43 AM   #1
addy86
Member
 
Registered: Nov 2004
Location: Germany
Distribution: Debian Testing
Posts: 332

Rep: Reputation: 31
Time source for fps calculation


I'm programming a game, and I need a time source to measure the time needed for one frame (in order to calculate the frames per second, and the movement of the little cars ).
SDL provides SDL_GetTicks(), but its resolution is 1 millisecond, which is to imprecise. Is there a better time source available on Linux (which is, if possible, also available on other POSIX-OS), something like GetPerformanceCounter() on Windows?

You might also want to have a look at this thread: http://www.linuxquestions.org/questi...hreadid=359828


Adrian
 
Old 09-05-2005, 04:16 PM   #2
addy86
Member
 
Registered: Nov 2004
Location: Germany
Distribution: Debian Testing
Posts: 332

Original Poster
Rep: Reputation: 31
Ok, I think I found out (I looked at the Wine source for QueryPerformanceCounter ): gettimeofday(2) seems to be the right thing.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Should I go with Nvidia ? CounterStrike Source gets only 15 fps ! TheHushedCaskeT Linux - Games 21 06-17-2005 11:37 AM
Open source: Time to pay up Ephracis Linux - News 4 02-15-2005 09:28 PM
Slooow FPS (one fps) with WineX and THPS3 forrest44 Linux - Games 5 06-10-2004 09:12 AM
c math calculation alaios Programming 3 06-01-2004 01:46 AM
Only one Sound Source at a time. eldaria Mandriva 1 02-26-2004 04:10 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration