ctf/tmf: allow multiple traces to be open with name clashing events
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / ctfadaptor / CtfTmfTimestamp.java
index 276d99de52664e1ba40cb5d6d0b65c0e19c64aa9..bff867e7bd56eba52e33de811d9575593ee5a9df 100644 (file)
@@ -1,37 +1,37 @@
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
 
-public class CtfTmfTimestamp extends TmfTimestamp implements ITmfTimestamp {
+package org.eclipse.linuxtools.tmf.core.ctfadaptor;
 
-    final private CtfTmfTrace fTrace;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
 
-    public CtfTmfTimestamp(long timestamp, CtfTmfTrace trace) {
-        fTrace = trace;
-        fValue = timestamp;
-        fScale = (byte) -9;
-    }
+/**
+ * The CTF adapter for the TMF timestamp. It's basically the same as a
+ * TmfTimestamp, but the scale is always nanoseconds, and the precision is 0.
+ *
+ * @version 1.2
+ * @author Matthew khouzam
+ */
+public final class CtfTmfTimestamp extends TmfTimestamp {
 
-    /*
-     * (non-Javadoc)
+    /**
+     * Constructor for CtfTmfTimestamp.
      *
-     * @see java.lang.Object#toString()
+     * @param timestamp
+     *            The timestamp value (in nanoseconds)
      */
-    @Override
-    public String toString() {
-        final long timestamp = fValue;
-        final Date d = new Date(timestamp / 1000000);
-        final DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss."); //$NON-NLS-1$
-        final long nanos = (timestamp % 1000000000);
-        StringBuilder output = new StringBuilder();
-        output.append(df.format(d));
-        output.append(String.format("%09d", nanos)); //$NON-NLS-1$
-        return output.toString();
+    public CtfTmfTimestamp(long timestamp) {
+        super(timestamp, ITmfTimestamp.NANOSECOND_SCALE, 0);
     }
 
 }
This page took 0.025955 seconds and 5 git commands to generate.