Skip to main content
GameDev.net gamedev.net
🔒 Locked

Time

Started by bobFritzelpuff Jun 25, 2008 at 6:50 PM 2 replies 1.4k views
Original Post
bobFritzelpuff
bobFritzelpuff
Is there any simple, cross-platform method of getting time, accurate to milliseconds, in C? I am working on a game (surprise surprise) and everything so far is platform independent, I would like to keep it that way. Is there any way to get time in milliseconds?
bobFritzelpuff
bobFritzelpuff
Thanks a bunch -- is gettimeofday() compatible with windows()? I code on linux, so I have no way of testing, but obviously I would like the program to run as seamlessly as possible on both OS's.

Thanks.
Electrons
Electrons
There is a way to get gettimeofday() to work on Windows. However, I've heard that gettimeofday() and ftime() aren't quite in-sync with Windows time, but time() is always accurate. Maybe give the link above a shot and see what comes out...?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.