Avoid copies of the StopWatch

This commit is contained in:
Olivier Goffart 2014-03-28 09:39:32 +01:00
parent 36a2c861c2
commit ba896b0550
5 changed files with 9 additions and 9 deletions

View file

@ -60,7 +60,7 @@ public:
/* Abort the sync. Called from the main thread */
void abort();
Utility::StopWatch stopWatch() { return _stopWatch; }
Utility::StopWatch &stopWatch() { return _stopWatch; }
signals:
void csyncError( const QString& );

View file

@ -76,7 +76,7 @@ QString SyncRunFileLog::instructionToStr( csync_instructions_e inst )
}
void SyncRunFileLog::start( Utility::StopWatch stopWatch )
void SyncRunFileLog::start( const Utility::StopWatch &stopWatch )
{
MirallConfigFile cfg;
_file.reset(new QFile(cfg.configPath() + QLatin1String("sync_log") ));

View file

@ -28,7 +28,7 @@ class SyncRunFileLog
{
public:
SyncRunFileLog();
void start( Utility::StopWatch stopWatch );
void start( const Utility::StopWatch &stopWatch );
void logItem( const SyncFileItem& item );
void close();

View file

@ -515,12 +515,12 @@ quint64 Utility::StopWatch::addLapTime( const QString& lapName )
return re;
}
QDateTime Utility::StopWatch::startTime()
QDateTime Utility::StopWatch::startTime() const
{
return _startTime;
}
QDateTime Utility::StopWatch::timeOfLap( const QString& lapName )
QDateTime Utility::StopWatch::timeOfLap( const QString& lapName ) const
{
quint64 t = durationOfLap(lapName);
if( t ) {
@ -531,7 +531,7 @@ QDateTime Utility::StopWatch::timeOfLap( const QString& lapName )
return QDateTime();
}
quint64 Utility::StopWatch::durationOfLap( const QString& lapName )
quint64 Utility::StopWatch::durationOfLap( const QString& lapName ) const
{
QPair<QString, quint64> lapPair;

View file

@ -79,9 +79,9 @@ namespace Utility
quint64 addLapTime( const QString& lapName );
// out helpers, return the masured times.
QDateTime startTime();
QDateTime timeOfLap( const QString& lapName );
quint64 durationOfLap( const QString& lapName );
QDateTime startTime() const;
QDateTime timeOfLap( const QString& lapName ) const;
quint64 durationOfLap( const QString& lapName ) const;
};
}