[Interest] QML int not big enough
Stanislas RENAN
qt-project at renan.org
Sun Sep 16 10:09:42 CEST 2018
Hi,
Le 15/09/2018 à 22:30, Jason H a écrit :
> Item {
> property int now: 0 // will be new Date().getTime() // milliseconds since epoch is 64 bit
> property var now: new Date().getTime() // this gives me a parning of "use int or real to improve performance (M311)
> }
>
> How can I use the right type and not get the warning?
Why not use real as the warning says ?
propertyrealnow:newDate().getTime()
Do not store the 64 bit value in an int as it overflows (getTime()
returns around 1537084902522 right now).
http://doc.qt.io/qt-5/qml-int.html
https://stackoverflow.com/questions/25709429/qt-qml-int-overflow
Best regards,
--
Stanislas RENAN
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180916/6f96d8c3/attachment.html>
More information about the Interest
mailing list