Closed Bug 568657 Opened 14 years ago Closed 14 years ago

consolidate all time stamp code

Categories

(DevTools :: General, defect, P3)

x86
All
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ddahl, Assigned: ddahl)

References

Details

Attachments

(1 file, 2 obsolete files)

Consolidate all time stamp code into a single function.
Assignee: nobody → ddahl
No longer blocks: 534398
Blocks: 529086
Priority: -- → P3
Attached patch initial try for consolidating timestamp code (obsolete) (deleted) — Splinter Review
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)
Blocks: 578658
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 on attachment 456304 [details] [diff] [review] initial try for consolidating timestamp code adding request for a mossop-flavored review.
Attachment #456304 - Flags: review?(dtownsend)
Attached patch patch update 2 (obsolete) (deleted) — Splinter Review
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)
Attachment #457583 - Flags: review? → review?(dietrich)
Comment on attachment 457583 [details] [diff] [review] patch update 2 r=me, thanks!
Attachment #457583 - Flags: review?(dietrich) → review+
Whiteboard: [checkin-needed]
updated patch for mozilla-central, as requested by Robert.
Attachment #457583 - Attachment is obsolete: true
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
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
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.
(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!
Note, the checkin referred to in comment #9 is later than the comment stated 'this has been checked in already'.
Whiteboard: [checkin-needed]
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: