Qt计算2个时间的秒间隔

          qint64 t1 = QDateTime::fromString("2020-11-26 03:07:09", "yyyy-MM-dd hh:mm:ss").toSecsSinceEpoch();

    qint64 t2 = QDateTime::fromString("2020-11-26 06:25:34", "yyyy-MM-dd hh:mm:ss").toSecsSinceEpoch();
    qDebug() << "t1 =" << t1 ;
    qDebug() << "t2 =" << t2 ;
    qDebug() << "current =" << QDateTime::currentSecsSinceEpoch() ;
    qDebug() << "t2-t1 =" << t2-t1 ;
原文地址:https://www.cnblogs.com/totogo/p/14841284.html