I want to get the time in milliseconds notation for example like this: HH:MM:SS:ms. How would I get this type of ouput?
I get the current time once via NTP-Client, this runs in the setup method:
Code: Select all
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
printLocalTime();
Code: Select all
void printLocalTime(){
struct tm timeinfo;
if(!getLocalTime(&timeinfo)){
Serial.println("Failed to obtain time");
return;
}
char now[100];
strftime(now, sizeof(now), "%Y-%m-%dT%H:%M:%S", &timeinfo);
Serial.println(now);
}
What would be a good way of achieving this?
Thank you.