Closed
Bug 1197145
Opened 11 years ago
Closed 11 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•11 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•11 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•11 years ago
|
Attachment #8650998 -
Flags: review?(nfroyd) → review+
| Assignee | ||
Comment 3•11 years ago
|
||
Keywords: checkin-needed
Keywords: checkin-needed
Comment 5•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 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
•