Skip to main content
2 of 3
added 89 characters in body
Juraj
  • 18.2k
  • 4
  • 30
  • 49

the goal is to generate unique and ordered millis part of timestamps in one epoch second.

unsigned long thisNowMillis;
uint32_t thisNow;
 uint32_t now = rtc_now_time.unixtime();
 if (now != thisNow) {
   thisNow = now;
   thisNowMillis = millis();
 }
 Serial.print("millis: "); Serial.print(millis() - thisNowMillis);

(not tested)

Juraj
  • 18.2k
  • 4
  • 30
  • 49