getTickCount() for Mac and Linux?
BlitzMax Forums/BlitzMax Programming/getTickCount() for Mac and Linux?
| ||
I would need a counterpart for getTickCount() for Mac/Linux. The reason is that I want to get back a Double, not just an Int. The Idea is to call something like getPreciseUptime:Double() which wraps the functionality for each platform. For Linux there seems to be gettimeofday(). I found 2 functions which kind of work. The first just Returns integers like Millisecs(), the second seems more promising ... long getTickCount() { struct sysinfo si; if(sysinfo(&si) == 0) return si.uptime; return -1; } int mtime() { struct timeval tv; gettimeofday(&tv,NULL); return (int)(tv.tv_sec*1000 + (tv.tv_usec / 1000)); } Would someone be able to post a version that returns a double(or float). For OSX there is http://developer.apple.com/library/mac/#qa/qa2004/qa1398.html However I don't have a Mac, so I'm not able to compile it and see if it works. Hope someone is able able to help out :D |