Measure time between incoming clocks (SOLVED)

Hello all, I am attempting to measure the time between incoming clocks using the code below (these are just snippets) on a Daisy Seed.

uint64_t currentTimestamp = 0;
uint64_t previousTimestamp = 0;

uint64_t timeSinceEpochMillisec() {
return duration_cast(system_clock::now().time_since_epoch()).count();

// Called on the rising edge of an incoming clock:
currentTimestamp = timeSinceEpochMillisec();
durationMs = (currentTimestamp - previousTimestamp);
previousTimestamp = timeSinceEpochMillisec();

Has anyone done this before that would be happy to share some code examples please?
The durationMs value is much higher than I am expecting and I am not sure if this is something I am doing incorrectly or not…

Kind Regards,

Update: I changed my code to use “System::GetNow()” to get the timestamps and now my code is working perfectly :slight_smile: