esp_timer_get_time starts counting from 0 at startup / wake from deep sleep. It increments every 1uS

0x0000000000000000 to 0x7FFFFFFFFFFFFF
9,223,372,036,854,775,807 uS
9,223,372,036,854 seconds
153,722,867,280 minutes
2,562,047,788 hours
106,751,991 days
292,471 years

Using esp_timer_get_time to time things

#include "esp_timer.h"

static int64_t HeartbeatLast1msTime = 0;

	while ((esp_timer_get_time() - HeartbeatLast1msTime) >= 1000)      //esp_timer_get_time() provides uS since startup. int64 x 1uS = 292,471 years before rollover
		HeartbeatLast1msTime += 1000;
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


Your email address will not be published. Required fields are marked *