Hi,
I think we need to talk about timestamps and the use of
Date.toLocaleString()
I'd been trying to work out why the Highchart Performance graphs I
added didn't render on my shiny new linux box (see MH-9233). The
workflow operation started and completed timestamps are converted to
have been converted to datestrings using Date.toLocaleString(). Seems a
nice idea as the string is formatted to your locale settings. The
problem is is makes is almost impossible to convert back into a
timestamp for computation. On my Windows machine Date can be constructed
from the locale string and my linux box it barfs. There is no reliable
way to convert locale strings back into timestamps so we can compute
things like graphs.
(Short term fix for this particular case was to compute the durations
before the timestamps are converted).
It may be to late to overhaul things for 1.4 and quicker to patch the
odd instance where the timestamps are required for calculation - however
later on who know what features that may be added that require them.
Off the top of my head I can think of 4 approaches:
1. Use the ugly but convertible UTC string format
2. Stick to timestamps, add a 'format' function to each data member so
it know how to display itself
3. Calculate any required numbers before timestamps are converted (fix
for 9233)
4. If you need the original values, request the data object from the
server again.
I've included Ruben's comments on this topic from an earlier issue below.
As a newbie I'm not aware of all the issues so please feel free to
correct me.
Regards
James
On 11/10/2012 11:59, Rubén Pérez Vázquez (Commented) (JIRA) wrote:
Rubén Pérez Vázquez commented on MH-8964:
-----------------------------------------
I don't know how are the time represented right now, but I'll leave
here my two cents anyway...
I think this should be brought to list and decide once and for all
what date/time format *every* template in the UI should expect. I
mean, we have enough cases of "this is done this way in this part of
the code, and this other way in this other part of the code". In my
opinion, since it's easier to represent and work with, we should keep
the dates as milliseconds from the Epoch, and *only* format that
date/time where it should be displayed.
Anyway, we should have a consensus on this to avoid this kind of
bugs.
It seems that we are gaining momentum with UI developers (whom we
have traditionally been lacking), so I guess it's the perfect
opportunity to make some clear decissions and fix this kind of
issues.
Just my humble opinion.
--
------------------------------------------------------------------------
James S. Perrin
Media Technologies Team
Devonshire House, University Precinct
The University of Manchester
Oxford Road, Manchester, M13 9PL
t: +44 (0) 161 275 6945
e: [email protected]
w: www.manchester.ac.uk/researchcomputing
------------------------------------------------------------------------
"The test of intellect is the refusal to belabour the obvious"
- Alfred Bester
------------------------------------------------------------------------
_______________________________________________
Matterhorn mailing list
[email protected]
http://lists.opencastproject.org/mailman/listinfo/matterhorn
To unsubscribe please email
[email protected]
_______________________________________________