~ubuntu-branches/ubuntu/raring/mumble/raring

« back to all changes in this revision

Viewing changes to src/Timer.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Thorvald Natvig, Patrick Matthäi, Thorvald Natvig
  • Date: 2011-02-19 22:58:58 UTC
  • mfrom: (9.1.15 sid)
  • Revision ID: james.westby@ubuntu.com-20110219225858-0xlftrf4z1z4jt9e
Tags: 1.2.3-1
[ Patrick Matthäi ]
* Do not build with non existant libpulse-dev on hurd-i386.

[ Thorvald Natvig ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
#include <windows.h>
59
59
 
60
60
quint64 Timer::now() {
61
 
        static quint64 f = 0LL;
 
61
        static double scale = 0;
62
62
 
63
 
        if (f == 0LL) {
 
63
        if (scale == 0) {
64
64
                LARGE_INTEGER freq;
65
65
                QueryPerformanceFrequency(&freq);
66
 
                f = freq.QuadPart;
 
66
                scale = 1000000. / freq.QuadPart;
67
67
        }
68
68
 
69
69
        LARGE_INTEGER li;
70
70
        QueryPerformanceCounter(&li);
71
71
        quint64 e = li.QuadPart;
72
72
 
73
 
        return (e * 1000000LL) / f;
 
73
        return static_cast<quint64>(e * scale);
74
74
}
75
75
#elif defined(Q_OS_UNIX)
76
76
#include <sys/time.h>