Please report any other irregularities here.
Consolidate all time stamp code into a single function.
Created attachment 456304 [details] [diff] [review] initial try for consolidating timestamp code 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!
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.
Created attachment 457583 [details] [diff] [review] patch update 2 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.
Comment on attachment 457583 [details] [diff] [review] patch update 2 r=me, thanks!
Attachment #457583 - Flags: review?(dietrich) → review+
Created attachment 457910 [details] [diff] [review] [checked-in] patch update 3 for mozilla-central 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 <firstname.lastname@example.org> 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
Last Resolved: 8 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'.
You need to log in before you can comment on or make changes to this bug.