How to calculate running time of nrf52840 or ESP32S3

Hi,
I want to calculate how long a microcontroller worked by using a kind of timer.
Could anybody help?

Have you tried millis() - Arduino Reference ?

Hello reivilo,

Thanks a lot for your response.
I used ESP32Time library for my question. Maybe it can help someone else as well.

Have a great day.