1 /**********************************************************************
2 * Copyright (c) 2013, 2014 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org
.eclipse
.tracecompass
.tmf
.ui
.viewers
.xycharts
;
14 import java
.text
.FieldPosition
;
15 import java
.text
.SimpleDateFormat
;
16 import java
.util
.Date
;
18 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.TmfTimestampFormat
;
21 * SimpleDateFormat class for displaying time information in SWT charts
22 * using the TmfTimestampFormat class.
24 * @author Bernd Hufmann
26 public class TmfChartTimeStampFormat
extends SimpleDateFormat
{
28 // ------------------------------------------------------------------------
30 // ------------------------------------------------------------------------
31 private static final long serialVersionUID
= 3719743469686142387L;
33 // ------------------------------------------------------------------------
35 // ------------------------------------------------------------------------
38 // ------------------------------------------------------------------------
40 // ------------------------------------------------------------------------
42 * Standard Constructor
45 * offset to apply before formatting time (time = time + offset)
47 public TmfChartTimeStampFormat(long offset
) {
51 // ------------------------------------------------------------------------
53 // ------------------------------------------------------------------------
55 public StringBuffer
format(Date date
, StringBuffer toAppendTo
, FieldPosition fieldPosition
) {
57 long time
= date
.getTime() + fOffset
;
58 toAppendTo
.append(TmfTimestampFormat
.getDefaulTimeFormat().format(time
));