Closed
Bug 1197145
Opened 8 years ago
Closed 8 years ago
Add easy zero/bool checks to TimeDuration and TimeStamp
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla43
Tracking | Status | |
---|---|---|
firefox43 | --- | fixed |
People
(Reporter: mozbugz, Assigned: mozbugz)
Details
Attachments
(1 file, 1 obsolete file)
1.77 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
I've found myself wanting a quick check for unit-less 0-values on [Base]TimeDuration objects, as currently this can only be done quite verbosely, e.g. |if (duration == TimeDuration(0)|. By extension, the same could be useful for TimeStamp. There is already a TimeStamp::IsNull(). Proposed additions: 1. |bool BaseTimeDuration::IsZero() const|, for consistency with TimeStamp::IsNull(). 2. |explicit BaseTimeDuration::operator bool() const|, for easy |if (duration)| tests. 3. |explicit TimeStamp::operator bool() const|, for easy |if (timestamp)| tests.
Assignee | ||
Comment 1•8 years ago
|
||
Implementation of BaseTimeDuration::IsZero(), BaseTimeDuration::operator bool(), TimeStamp::operator bool(). Happy to discuss whether we actually need&want any/all of these. Also I could split them in separate patches if preferred.
Assignee: nobody → gsquelart
Attachment #8650971 -
Flags: review?(nfroyd)
Assignee | ||
Comment 2•8 years ago
|
||
(Sorry for the new rev, fixed a compilation error on Windows.) Implementation of BaseTimeDuration::IsZero(), BaseTimeDuration::operator bool(), TimeStamp::operator bool(). Happy to discuss whether we actually need&want any/all of these. Also I could split them in separate patches if preferred.
Attachment #8650971 -
Attachment is obsolete: true
Attachment #8650971 -
Flags: review?(nfroyd)
Attachment #8650998 -
Flags: review?(nfroyd)
![]() |
||
Updated•8 years ago
|
Attachment #8650998 -
Flags: review?(nfroyd) → review+
Assignee | ||
Comment 3•8 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=6909d3c9310f
Keywords: checkin-needed
Comment 5•8 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/332b56e30115
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox43:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in
before you can comment on or make changes to this bug.
Description
•