Internat timer BC66 with OpenCPU

Hi everyone,

Is there any possibility to get a counter or timer with the total number of millisenconds since the device wakeup.

Right now, I am using the library: ql_time.h with this command:

/* Session time: Init time */
Ql_GetLocalTime(&tm);
init_time = Ql_Mktime(&tm);

/* Session time: End time */
Ql_GetLocalTime(&tm);
end_time = Ql_Mktime(&tm);
total_time = end_time - init_time;

But I need millisencods instead seconds.

Best regards.

Ql_OS_GetTaskTickCount() * 10

1 Like

I think Ql_OS_GetTaskTickCount() is the number of ticks the task is running, so if the task is suspended it doen not increment, it is just for statics purposes only.

u32 Ql_OS_GetTaskTickCount() {
return xTaskGetTickCount(); // The count of ticks since vTaskStartScheduler was called.
}

1 Like

Hi everyone,

It is working perfectly. The only thing is that the second time I init the applicaiton from deep sleep, this counter has a value different from 0. So it seems to be somehow the value is stored, so I have to do this:

Ql_Sleep_Disable();
init_time =  Ql_OS_GetTaskTickCount() * 10;

my tasks....

session_time = Ql_OS_GetTaskTickCount() * 10 - init_time ;
Ql_Sleep_Enable();

Is there any way to reset that counter every time my app starts?

Best regards.