Quote:
Originally Posted by btslaser
I meant to ask if System.currentTimeMillis() is the best time source -or- is there some other timeStamp to use?
|
Don't know about Java, but in C++ there appears to be a nanosecond timer in WPILib
:
Code:
/**
* @brief Gives real-time clock system time with nanosecond resolution
* @return The time, just in case you want the robot to start autonomous at 8pm on Saturday.
*/
double GetTime()
{
struct timespec tp;
clock_gettime(CLOCK_REALTIME,&tp);
double realTime = (double)tp.tv_sec + (double)((double)tp.tv_nsec*1e-9);
return (realTime);
}