• 2160阅读
  • 3回复

关于 qDebug 的疑惑? [复制链接]

上一主题 下一主题
离线liulin188
 

只看楼主 倒序阅读 楼主  发表于: 2019-11-28
大家试试输出下面的代码
qDebug("%d %d", QDateTime::currentSecsSinceEpoch(), QDateTime::currentSecsSinceEpoch());
或者
qDebug("%d %d", QDateTime::currentSecsSinceEpoch(), 1574923867);
第2个总是打印0,奇怪啊
https://wiki.qt.io/Qt_5.12_Release
https://wiki.qt.io/New_Features_in_Qt_5.12
https://wiki.qt.io/Qt_5.12.0_Known_Issues
https://www.qt.io/blog/qt-5.13.2-released
https://www.qt.io/blog/qt-creator-4.10.2-released
https://wiki.qt.io/Qt_5.12_Tools_and_Versions
离线qq860930595

只看该作者 1楼 发表于: 2019-11-28
把%d改为%lld
qDebug("%lld %lld", QDateTime::currentSecsSinceEpoch(), QDateTime::currentSecsSinceEpoch());
离线liulin188

只看该作者 2楼 发表于: 2019-11-28
回 qq860930595 的帖子
qq860930595:把%d改为%lld
qDebug("%lld %lld", QDateTime::currentSecsSinceEpoch(), QDateTime::currentSecsSinceEpoch());
 (2019-11-28 16:14) 

是可以,不过这个值完全没有溢出,换个方法也可以,就是不知道我还什么这样不行
https://wiki.qt.io/Qt_5.12_Release
https://wiki.qt.io/New_Features_in_Qt_5.12
https://wiki.qt.io/Qt_5.12.0_Known_Issues
https://www.qt.io/blog/qt-5.13.2-released
https://www.qt.io/blog/qt-creator-4.10.2-released
https://wiki.qt.io/Qt_5.12_Tools_and_Versions
离线sharkoasis

只看该作者 3楼 发表于: 2019-11-30
为什么不qDebug()<<QDateTime::currentSecsSinceEpoch()<<QDateTime::currentSecsSinceEpoch(),就没有烦恼了
快速回复
限100 字节
 
上一个 下一个