Merge lp:~aacid/qtmir/timestampsInPast into lp:qtmir

Proposed by Albert Astals Cid
Status: Merged
Approved by: Gerry Boland
Approved revision: 429
Merged at revision: 445
Proposed branch: lp:~aacid/qtmir/timestampsInPast
Merge into: lp:qtmir
Diff against target: 17 lines (+4/-2)
1 file modified
src/common/timestamp_impl.h (+4/-2)
To merge this branch: bzr merge lp:~aacid/qtmir/timestampsInPast
Reviewer Review Type Date Requested Status
Nick Dedekind (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+280567@code.launchpad.net

Commit message

Reset start time if the timestamp travels to the past

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

Yup, that looks fine to me!

Revision history for this message
Nick Dedekind (nick-dedekind) :
review: Approve
Revision history for this message
Gerry Boland (gerboland) wrote :

Top-approving

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/common/timestamp_impl.h'
2--- src/common/timestamp_impl.h 2015-10-29 11:58:29 +0000
3+++ src/common/timestamp_impl.h 2015-12-15 11:09:02 +0000
4@@ -15,9 +15,11 @@
5 {
6 std::chrono::nanoseconds startTime = getStartTime(timestamp);
7
8- if (std::chrono::nanoseconds::max() > T::max() &&
9- timestamp - startTime > std::chrono::nanoseconds(T::max())) {
10+ if ((std::chrono::nanoseconds::max() > T::max() &&
11+ timestamp - startTime > std::chrono::nanoseconds(T::max()))
12+ || timestamp < startTime) {
13 // we've overflowed the boundaries of the millisecond type.
14+ // or the timestamp has travelled to the past
15 resetStartTime(timestamp);
16 return T(0);
17 }

Subscribers

People subscribed via source and target branches