c++ Linux TickCount

c++, linux

Solution

clock_gettime with CLOCK_MONOTONIC is the magic incantation you seem to be looking for. Sample code, untested:

struct timespec *t;
t = (struct timespec *)malloc(sizeof(t)); 
clock_gettime(CLOCK_MONOTONIC, t);

Let me know how you get on. I'm not on Linux at the moment, hence this is just conjecture from the man page I pointed to.

Problem

Is there a similar function like GetTickCount() for Linux? I´ve tried out some other sutff, but they didn´t work at all. So it should return the exact time in milliseconds since startup.

Original source