Logo Search packages:      
Sourcecode: qt4-x11 version File versions

int QTime::restart (  ) 

Sets this time to the current time and returns the number of milliseconds that have elapsed since the last time start() or restart() was called.

This function is guaranteed to be atomic and is thus very handy for repeated measurements. Call start() to start the first measurement, and restart() for each later measurement.

Note that the counter wraps to zero 24 hours after the last call to start() or restart().

If the system's clock setting has been changed since the last time start() or restart() was called, the result is undefined. This can happen when daylight savings time is turned on or off.
See also:
start(), elapsed(), currentTime()

Definition at line 1845 of file qdatetime.cpp.

References currentTime(), and msecsTo().

    QTime t = currentTime();
    int n = msecsTo(t);
    if (n < 0)                                // passed midnight
        n += 86400*1000;
    *this = t;
    return n;

Generated by  Doxygen 1.6.0   Back to index