Intel® Makers
Intel® Edison, Intel® Joule™, Intel® Curie™, Intel® Galileo
Announcements
Welcome - This is a Peer-to-Peer Forum only. Intel has discontinued these products but you may find support from other customers on this Forum
9882 Discussions

Implementing the arduino function millis() in C++

CBrou1
New Contributor I
961 Views

I am using the Eclipse IDE but i would like to reuse some arduino libraries so I am coding a few missing classes and functions.

 

Any suggestion about the best way to implement millis() ?

1 Solution
CBrou1
New Contributor I
136 Views

I found a solution:

unsigned long millis(){

struct timespec tt;

clock_gettime(CLOCK_MONOTONIC, &tt);

return tt.tv_nsec/1000000+ tt.tv_sec * 1000;

}

View solution in original post

1 Reply
CBrou1
New Contributor I
137 Views

I found a solution:

unsigned long millis(){

struct timespec tt;

clock_gettime(CLOCK_MONOTONIC, &tt);

return tt.tv_nsec/1000000+ tt.tv_sec * 1000;

}

Reply