Skip to content

Commit 567c124

Browse files
authored
Update esp32-hal-misc.c
Fixed the millis() function, which previously returned values in nanoseconds due to dividing esp_timer_get_time() (microseconds) by 1000ULL. The implementation now multiplies by 1000ULL, ensuring the function correctly returns elapsed time in milliseconds.
1 parent d136bce commit 567c124

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cores/esp32/esp32-hal-misc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ unsigned long ARDUINO_ISR_ATTR micros() {
206206
}
207207

208208
unsigned long ARDUINO_ISR_ATTR millis() {
209-
return (unsigned long)(esp_timer_get_time() / 1000ULL);
209+
return (unsigned long)(esp_timer_get_time() * 1000ULL);
210210
}
211211

212212
void delay(uint32_t ms) {

0 commit comments

Comments
 (0)