mirror of
https://github.com/esphome/esphome.git
synced 2026-10-07 03:16:37 +00:00
[host] Use native clock_gettime for millis_64() (#14340)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
3411ce2150
commit
8698b01bc7
@@ -20,7 +20,11 @@ uint32_t IRAM_ATTR HOT millis() {
|
||||
uint32_t ms = round(spec.tv_nsec / 1e6);
|
||||
return ((uint32_t) seconds) * 1000U + ms;
|
||||
}
|
||||
uint64_t millis_64() { return App.scheduler.millis_64_impl_(millis()); }
|
||||
uint64_t millis_64() {
|
||||
struct timespec spec;
|
||||
clock_gettime(CLOCK_MONOTONIC, &spec);
|
||||
return static_cast<uint64_t>(spec.tv_sec) * 1000ULL + static_cast<uint64_t>(spec.tv_nsec) / 1000000ULL;
|
||||
}
|
||||
void HOT delay(uint32_t ms) {
|
||||
struct timespec ts;
|
||||
ts.tv_sec = ms / 1000;
|
||||
|
||||
Reference in New Issue
Block a user