Community
cancel
Showing results for 
Search instead for 
Did you mean: 
CBrou1
New Contributor I
881 Views

Implementing the arduino function millis() in C++

Jump to solution

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
56 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
57 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

Reply