我被这个问题困住了。
我已经currentUTCtime
从QDateTime
. 问题是,我找不到以秒为单位将其转换为本地时间的可能方法。有一些类似的 QDate 函数toLocalTime()
似乎不起作用。我希望这里有人可以帮助我。
QDateTime::currentMSecsSinceEpoch();
QDateTime currentateTime = QDateTime::currentDateTime();
QDateTime UTC(QDateTime::currentDateTimeUtc());
currentDateTime.toString().toStdString();
TimeNow = currentDateTime.toMSecsSinceEpoch()/1000;
以上是我当前UTC时间的代码(以秒为单位)。