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
.TmfTimestamp
;
9 public class CtfTmfTimestamp
extends TmfTimestamp
{
11 final private CtfTmfTrace fTrace
;
13 public CtfTmfTimestamp(long timestamp
, CtfTmfTrace trace
) {
15 setValue(timestamp
, -9, 0);
19 * @see java.lang.Object#hashCode()
22 public int hashCode() {
24 int result
= super.hashCode();
25 result
= (prime
* result
) + ((fTrace
== null) ?
0 : fTrace
.hashCode());
30 * @see java.lang.Object#equals(java.lang.Object)
33 public boolean equals(Object obj
) {
37 if (!super.equals(obj
)) {
40 if (!(obj
instanceof CtfTmfTimestamp
)) {
43 CtfTmfTimestamp other
= (CtfTmfTimestamp
) obj
;
45 if (other
.fTrace
!= null) {
48 } else if (!fTrace
.equals(other
.fTrace
)) {
57 * @see java.lang.Object#toString()
60 public String
toString() {
61 final long timestamp
= getValue();
62 final Date d
= new Date(timestamp
/ 1000000);
63 final DateFormat df
= new SimpleDateFormat("HH:mm:ss."); //$NON-NLS-1$
64 final long nanos
= (timestamp
% 1000000000);
65 StringBuilder output
= new StringBuilder();
66 output
.append(df
.format(d
));
67 output
.append(String
.format("%09d", nanos
)); //$NON-NLS-1$
68 return output
.toString();
71 public String
toFullDateString(){
72 final long timestamp
= getValue();
73 final Date d
= new Date(timestamp
/ 1000000);
74 final DateFormat df
= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss."); //$NON-NLS-1$
75 final long nanos
= (timestamp
% 1000000000);
76 StringBuilder output
= new StringBuilder();
77 output
.append(df
.format(d
));
78 output
.append(String
.format("%09d", nanos
)); //$NON-NLS-1$
79 return output
.toString();
This page took 0.032844 seconds and 6 git commands to generate.