I use esp32 to do two things, to get NTP epoch time in milliseconds, and to read another epoch time from the Firebase Realtime database, I want to subtract them to get the difference in milliseconds so I need to convert them to long long because long can only contain 10 digits and milliseconds epoch is 13 digits, I tried to convert them to long long with this code inside a function:
void setup(){
Serial.begin(9600);
}
void loop(){
convertEpoch()
}
void convertEpoch(){
char* p;
checkRegTime = strtoll(checkRegTime.c_str(),&p, 10);
Serial.println(checkRegTime);
}
but it gives this error:
conversion from 'long long int' to 'StringSumHelper' is ambiguous
I tried to use time_t for both but I can't find how to convert from string to time_t (I only can read the checkRegTime variable as a string from Firebase Realtime database because it saves the timestamp as string)
is there a way to convert then subtract them? and how to convert a string to long long in Arduino? since I tried all answers and it doesn't seem to solve the problem it self