Closed
Bug 568657
Opened 14 years ago
Closed 14 years ago
consolidate all time stamp code
Categories
(DevTools :: General, defect, P3)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: ddahl, Assigned: ddahl)
References
Details
Attachments
(1 file, 2 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review |
Consolidate all time stamp code into a single function.
Assignee | ||
Updated•14 years ago
|
Assignee: nobody → ddahl
Assignee | ||
Updated•14 years ago
|
Priority: -- → P3
Comment 1•14 years ago
|
||
This is my try at consolidating the timestamp code.
What I decided is that messages need timestamps as integers - milliseconds from the UNIX epoch. They should not hold hard-coded strings, because this prevents one from quickly comparing two messages if one is older or newer than the other.
For displaying the timestamps I added a new method in ConsoleUtils: timestampString() which takes as input a date in the milliseconds format.
The localization issue is still there. I believe that timestamps should be displayed by code inside the HeadUpDisplay object instances, at runtime - message objects themselves should have no DOM nodes, and no hard-coded strings as they do now. The patch I provide is minimal, by not changing code related to the issue of how the GUI code works.
I bumped into this issue while working on bug 552143. I'll have to rely on message objects having an integer timestamp. I would not like to timestamp each message for a second time when the message is recorded in the console storage. I want to reuse the timestamp property from the message object itself.
Please let me know if I can improve the code further.
Thanks!
Attachment #456304 -
Flags: review?(ddahl)
Comment 2•14 years ago
|
||
Comment on attachment 456304 [details] [diff] [review]
initial try for consolidating timestamp code
in timestamp():
+ return (new Date()).getTime();
why not just use
return Date.now(); ?
in timestampString():
+ return pad(d.getHours()) + ":"
+ + pad(d.getMinutes()) + ":"
+ + pad(d.getSeconds()) + ":"
+ + pad(d.getMilliseconds(), true);
pretty sure you're going to need a stringBundle and properly-defined hoursSeparator, minutesSeparator, secondsSeparator for l10n.
Comment 3•14 years ago
|
||
Comment on attachment 456304 [details] [diff] [review]
initial try for consolidating timestamp code
adding request for a mossop-flavored review.
Attachment #456304 -
Flags: review?(dtownsend)
Comment 4•14 years ago
|
||
Thank you Robert for the review!
I updated the patch to use Date.now().
This patch, like the previous one, applies cleanly on mozilla-central and on ddahl's user repository.
Attachment #456304 -
Attachment is obsolete: true
Attachment #457583 -
Flags: review?
Attachment #456304 -
Flags: review?(dtownsend)
Attachment #456304 -
Flags: review?(ddahl)
Updated•14 years ago
|
Attachment #457583 -
Flags: review? → review?(dietrich)
Comment 5•14 years ago
|
||
Comment on attachment 457583 [details] [diff] [review]
patch update 2
r=me, thanks!
Attachment #457583 -
Flags: review?(dietrich) → review+
Updated•14 years ago
|
Whiteboard: [checkin-needed]
Comment 6•14 years ago
|
||
updated patch for mozilla-central, as requested by Robert.
Attachment #457583 -
Attachment is obsolete: true
Comment 7•14 years ago
|
||
Comment on attachment 457910 [details] [diff] [review]
[checked-in] patch update 3 for mozilla-central
changeset: 47919:4989f8c0fdc3
user: Mihai Sucan <robodesign@gmail.com>
date: Mon Jul 19 10:51:51 2010 -0300
summary: bug 568657 - consolidate all time stamp code
Attachment #457910 -
Attachment description: patch update 3 for mozilla-central → [checked-in] patch update 3 for mozilla-central
Updated•14 years ago
|
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment 8•14 years ago
|
||
A small optimization option:
replace pad(x,mil) with pad(x) and padmil(x), to prevent the check for mil.
And why: new Date(ms ? ms : null);
new Date(ms) should also work.
Comment 9•14 years ago
|
||
(In reply to comment #8)
> A small optimization option:
> replace pad(x,mil) with pad(x) and padmil(x), to prevent the check for mil.
>
> And why: new Date(ms ? ms : null);
> new Date(ms) should also work.
this has been checked in already. if you see improvements, please file a separate bug and attach your patch.
thanks!
Comment 10•14 years ago
|
||
Comment 11•14 years ago
|
||
Note, the checkin referred to in comment #9 is later than the comment stated 'this has been checked in already'.
Updated•14 years ago
|
Whiteboard: [checkin-needed]
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•