I want to get the milliseconds difference between two QDateTimes. My code is the following:
QDateTime t1 = QDateTime();
t1 = QDateTime::fromString("2019-12-16 23:59:59.974", "yyyy-MM-dd HH:mm:ss.zzz");
QDateTime t2 = QDateTime();
t2 = QDateTime::fromString("2019-12-17 00:00:00.018", "yyyy-MM-dd HH:mm:ss.zzz");
int nDiff = t2.time().msecsTo(t1.time());
printed nDiff
value is 86399956.
What is wrong this code?