How can I get the current time in milliseconds in Tizen native?

Is there an equivalent to the Web API call


in Tizen Native?

Or something like System.currentTimeMillis() in Java to get the current timestamp in Milliseconds since January 1, 1970 UTC?

I just need to store that value to be able to measure the time elapsed between two events in the running app. Or is there a more elegant way to accomplish this in Tizen Native ?

You can use below:
struct timeval te;
gettimeofday(&te, NULL); // get current time
long long milliseconds = te.tv_sec*1000LL + te.tv_usec/1000;

learn more here:

Thanks! Works great. I also experimented with clock_gettime(), which also seems to work fine for my purpose.

I made my own function like this:

long getTimeNow_ms() {

struct timespec ts_now;

clock_gettime(CLOCK_MONOTONIC_COARSE, &ts_now);
// CLOCK_MONOTONIC_COARSE is not quite as accurate, but faster.

return ts_now.tv_sec * 1000 + ts_now.tv_nsec / 1.0e6 ; // return value in to milliseconds