Skip to main content
3 of 3
added 58 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 and it will not work for counting intervals between timestamps.

Juraj
  • 18.2k
  • 4
  • 30
  • 49