Skip to content

Instantly share code, notes, and snippets.

@AlexBolotsin
Created November 17, 2016 18:22
Show Gist options
  • Save AlexBolotsin/ad2fe5a64be086f5da023079871702c7 to your computer and use it in GitHub Desktop.
Save AlexBolotsin/ad2fe5a64be086f5da023079871702c7 to your computer and use it in GitHub Desktop.
QString time_str1 = "02:43:02.343"; // .343
QString time_str2 = "02:43:07.176"; // .643
QDateTime time1 = QDateTime::fromString(time_str1, "hh:mm:ss.zzz");
QDateTime time2 = QDateTime::fromString(time_str2, "hh:mm:ss.zzz");
qint64 diff = time1.msecsTo(time2);
int seconds = diff / 1000;
int msec = diff % 1000;
qDebug() << "HEre is your time" << seconds << msec;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment