diff options
author | Patrick Tasse | 2012-12-05 23:54:13 +0000 |
---|---|---|
committer | Patrick Tasse | 2012-12-06 20:08:20 +0000 |
commit | d0b467d677467929ce7020193b14d3e72a460ed8 (patch) | |
tree | 8d9136120a1d2979f2807fa50d54a8d0316a24d0 | |
parent | 9474b3a1da318e1edb090941bbcfe78e8cf0cede (diff) | |
download | org.eclipse.linuxtools-lttng-kepler-stable.tar.gz org.eclipse.linuxtools-lttng-kepler-stable.tar.xz org.eclipse.linuxtools-lttng-kepler-stable.zip |
Fix histogram current event and time stamp format parsinglttng-kepler-stable
The parsing of date format is updated to use the time stamp format's
time zone.
DAY_OF_YEAR field is not copied from the reference time as setting it
also updates the MONTH and DATE, causing premature break out of the
field-copying loop.
HOUR_OF_DAY field is used to copy from the reference time instead of
the HOUR field, as the latter only uses a 12-hour clock.
The current event text control now uses the current event time value as
a reference time for parsing, instead of the trace start time. This
allows a time stamp format preference, which contains insufficient date
and time fields to fully represent the whole trace range, to be usable
in the text control. The non-visible date and time fields are assumed to
be set equal to those of the current event.
Change-Id: I25c67787c20aa26a0f267f8d460b441b74185122
Reviewed-on: https://git.eclipse.org/r/9051
Tested-by: Hudson CI
Reviewed-by: Bernd Hufmann <bhufmann@gmail.com>
IP-Clean: Bernd Hufmann <bhufmann@gmail.com>
Tested-by: Bernd Hufmann <bhufmann@gmail.com>
2 files changed, 5 insertions, 7 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/TmfTimestampFormat.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/TmfTimestampFormat.java index a8bf8a8195..d262370785 100644 --- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/TmfTimestampFormat.java +++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/TmfTimestampFormat.java @@ -500,25 +500,23 @@ public class TmfTimestampFormat extends SimpleDateFormat { if (seconds == -1) { Date baseDate = super.parse(sb.toString()); - Calendar refTime = Calendar.getInstance(TimeZone.getTimeZone("UTC")); //$NON-NLS-1$ + Calendar refTime = Calendar.getInstance(getTimeZone()); refTime.setTimeInMillis(ref / 1000000); - Calendar newTime = Calendar.getInstance(TimeZone.getTimeZone("UTC")); //$NON-NLS-1$ + Calendar newTime = Calendar.getInstance(getTimeZone()); newTime.setTimeInMillis(baseDate.getTime()); - int[] fields = new int[] { Calendar.YEAR, Calendar.DAY_OF_YEAR, Calendar.MONTH, Calendar.DATE, Calendar.HOUR, Calendar.MINUTE, Calendar.SECOND }; + int[] fields = new int[] { Calendar.YEAR, Calendar.MONTH, Calendar.DATE, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND }; for (int field : fields) { int value = newTime.get(field); // Do some adjustments... if (field == Calendar.YEAR) { value -= 1970; - } else if (field == Calendar.DATE || field == Calendar.DAY_OF_YEAR) { + } else if (field == Calendar.DATE) { value -= 1; } // ... and fill-in the empty fields if (value == 0) { newTime.set(field, refTime.get(field)); - } else if (field == Calendar.DAY_OF_YEAR) { - newTime.set(field, value); } else { break; // Get out as soon as we have a significant value } diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramCurrentTimeControl.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramCurrentTimeControl.java index 678110ee53..91b7d35cf9 100644 --- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramCurrentTimeControl.java +++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramCurrentTimeControl.java @@ -78,7 +78,7 @@ public class HistogramCurrentTimeControl extends HistogramTextControl { String string = fTextValue.getText(); long value = 0; try { - value = TmfTimestampFormat.getDefaulTimeFormat().parseValue(string, fTraceStartTime); + value = TmfTimestampFormat.getDefaulTimeFormat().parseValue(string, getValue()); } catch (ParseException e) { } if (getValue() != value) { |