yes, they are both referenced to when the program was run.
They are in fact different timer sources, the mS timer is incremented under firmware interrupt. The high resolution timer is a special timer that we read from the hardware and is divided down to make a uS timer. They should both track as everything is derived from the same master clock.
we also have a timer that gives time since power on, but I didn’t expose that in the C++ timer class. Timer class is pretty useful as it also has a simple event system, I posted this once before, but here’s a refresher.
timer Timer;
void cb( void *arg ) {
std::cout << "timer fired sys:" << timer::system() << " timer:" << Timer << " \n";
// rearm
timer().event( cb, 1000 );
}
int main()
{
// fire in 1 seconds time
timer().event( cb, 1000 );
while(1)
this_thread::sleep_for(10);
}
It’s an alternate to using tasks, do something like start motors, start a timer, when timer fires perhaps stop the motors. You can rearm the timer in the event to make a periodic timer.