我在 Windows 上使用 Qt5.6、MSVC2013 32 位以及在 Ubuntu 上使用 Qt5.4、64 位。我正在尝试解析日志系统日志以将 _SOURCE_REALTIME_TIMESTAMP 转换为人类可读的文本。不知何故,毫秒都是 0。想知道显示毫秒甚至微秒的正确方法是什么?
bool ok;
QString ss = "1462962462893977";
const qlonglong s = ss.toLongLong(&ok );
if ( !ok ) {
qDebug() << "Error1";
}
const QDateTime dt = QDateTime::fromTime_t( s/1000000 );
const QString textdate = dt.toString( "yyyy-MM-dd hh:mm:ss.zzz" );
qDebug() <<"==>" << textdate;
PC/UBuntu 的结果是 ==> "2016-05-11 03:27:42.000" 毫秒都是 0,我希望有数字。
谢谢!