nathan-osman / NitroShare-Mac

Mac OS X project files and source code for building NitroShare.
3 stars 2 forks source link

Qt 4.6.4 QDateTime Code #8

Closed mateosalta closed 11 years ago

mateosalta commented 11 years ago

In making a ppc version some of the code in CbasicBroadcaster.cpp and CBroadcastServer.cpp was deleted to prevent build errors, https://github.com/nathan-osman/NitroShare-Mac/compare/master...PPC

This is probably something to do with differences in the versions, here is a manual for 4.6 QDateTime, http://qt.developpez.com/doc/4.6/qdatetime/

I'm hoping we can make changes to put the functionality back in.

nathan-osman commented 11 years ago

Ah, that's because the currentMSecsSinceEpoch() method wasn't added until Qt 4.7. However, you can replace:

QDateTime::currentMSecsSinceEpoch()

With:

(QDateTime::toTime_t() * 1000)

This does the exact same thing but it will compile on Qt 4.6.

mateosalta commented 11 years ago

Ok getting close, it still complains a bit, I changed line 31 in CBasicBroadcaster from

m_uptime = QDateTime::currentMSecsSinceEpoch();

To:

m_uptime = (QDateTime::toTime_t() * 1000);

and got this error on build:

error: cannot call member function 'uint QDateTime::toTime_t() const' without object

nathan-osman commented 11 years ago

Oops. I made a slight error. This is the correct code to insert:

(QDateTime().toTime_t() * 1000)

I didn't realize that toTime_t() wasn't a static method :disappointed:

mateosalta commented 11 years ago

Awesome, that did the trick. That should make the PPC-Mac version just as good as the other. :)