Skip to main content
added 58 characters in body
Source Link
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 not tested) and it will not work for counting intervals between timestamps.

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)

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.

added 89 characters in body
Source Link
Juraj
  • 18.2k
  • 4
  • 30
  • 49

not tested: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)

not tested:

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);

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)

Source Link
Juraj
  • 18.2k
  • 4
  • 30
  • 49

not tested:

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);