1 package org
.eclipse
.linuxtools
.tmf
.core
.ctfadaptor
;
3 import java
.text
.DateFormat
;
4 import java
.text
.SimpleDateFormat
;
7 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfTimestamp
;
8 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfTimestamp
;
10 public class CtfTmfTimestamp
extends TmfTimestamp
implements ITmfTimestamp
{
12 final private CtfTmfTrace fTrace
;
14 public CtfTmfTimestamp(long timestamp
, CtfTmfTrace trace
) {
21 * @see java.lang.Object#hashCode()
24 public int hashCode() {
26 int result
= super.hashCode();
27 result
= (prime
* result
) + ((fTrace
== null) ?
0 : fTrace
.hashCode());
32 * @see java.lang.Object#equals(java.lang.Object)
35 public boolean equals(Object obj
) {
39 if (!super.equals(obj
)) {
42 if (!(obj
instanceof CtfTmfTimestamp
)) {
45 CtfTmfTimestamp other
= (CtfTmfTimestamp
) obj
;
47 if (other
.fTrace
!= null) {
50 } else if (!fTrace
.equals(other
.fTrace
)) {
59 * @see java.lang.Object#toString()
62 public String
toString() {
63 final long timestamp
= fValue
;
64 final Date d
= new Date(timestamp
/ 1000000);
65 final DateFormat df
= new SimpleDateFormat("HH:mm:ss."); //$NON-NLS-1$
66 final long nanos
= (timestamp
% 1000000000);
67 StringBuilder output
= new StringBuilder();
68 output
.append(df
.format(d
));
69 output
.append(String
.format("%09d", nanos
)); //$NON-NLS-1$
70 return output
.toString();
73 public String
toFullDateString(){
74 final long timestamp
= fValue
;
75 final Date d
= new Date(timestamp
/ 1000000);
76 final DateFormat df
= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss."); //$NON-NLS-1$
77 final long nanos
= (timestamp
% 1000000000);
78 StringBuilder output
= new StringBuilder();
79 output
.append(df
.format(d
));
80 output
.append(String
.format("%09d", nanos
)); //$NON-NLS-1$
81 return output
.toString();
This page took 0.031336 seconds and 5 git commands to generate.