diff -r 1c7fd3151ba2 -r 64acf4452ac0 TimeTracker/TimeTrackEntry.py --- a/TimeTracker/TimeTrackEntry.py Sat Oct 20 22:46:24 2012 +0200 +++ b/TimeTracker/TimeTrackEntry.py Sun Oct 21 14:53:23 2012 +0200 @@ -7,7 +7,7 @@ Module implementing the time track entry class. """ -from PyQt4.QtCore import Qt, QDateTime +from PyQt4.QtCore import Qt, QDateTime, QTime class TimeTrackEntry(object): @@ -111,7 +111,7 @@ """ Public method to set the start time of this entry. """ - self.__startDateTime = QDateTime.currentDateTime() + self.__startDateTime = self.__currentDateTime() self.__continueDateTime = QDateTime(self.__startDateTime) def stop(self): @@ -144,7 +144,7 @@ Public method to continue the entry. """ if self.__paused: - self.__continueDateTime = QDateTime(self.__startDateTime) + self.__continueDateTime = self.__currentDateTime() self.__paused = False def isPaused(self): @@ -155,6 +155,18 @@ """ return self.__paused + def __currentDateTime(self): + """ + Private method to get the current date and time without milliseconds. + + @return current date and time (QDateTime) + """ + dt = QDateTime.currentDateTime() + t = dt.time() + t2 = QTime(t.hour(), t.minute(), t.second()) + dt.setTime(t2) + return dt + def __calculateDuration(self, start, stop): """ Private method to calculate the duration in minutes.