Closed Bug 497698 Opened 17 years ago Closed 17 years ago

Can we remove aOther.IsNull() assertion from TimeStamp's operator-

Categories

(Core :: XPCOM, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: Natch, Unassigned)

Details

I don't see what's wrong with subtracting zero? The assertion that the TimeStamp we're subtracting from is not 0 is definitely necessary, but what does it matter if aOther is 0? Patch forthcoming if it's ok'ed.
Null means "no timestamp" or "don't know". It makes no sense to do anything with Null except maybe compare it to something else.
In the code I'm using it in bug 61098 I want to compare the last time a dialog was opened to TimeStamp::Now. Problem is that it starts with 0 the first time a dialog is opened as there never was a dialog before. So 0 (or Null) to me means "no time yet".
Sorry, not compare, rather subtract. My intention is to see if the last dialog was opened within 3 seconds of this new dialog.
Right. So you should write if (!mLastOpen.IsNull() && now - mLastOpen < ...) {}
(In reply to comment #4) > Right. So you should write > if (!mLastOpen.IsNull() && now - mLastOpen < ...) {} I did that after encountering the assertion, but I was trying to understand what the issue was with just subtracting without the null check. Just trying to be lazy, I guess. ->WONTFIX
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.