~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java

  • Committer: Package Import Robot
  • Author(s): tony mancill
  • Date: 2013-05-13 21:43:22 UTC
  • mfrom: (1.2.1) (2.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130513214322-6frgd9du1n0w2uo7
Tags: 1.2.1-1
* Team upload.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
/**
22
22
 * The CTF adapter for the TMF timestamp
23
 
 * 
 
23
 *
24
24
 * @version 1.0
25
25
 * @author Matthew khouzam
26
26
 */
125
125
        case SECONDS:{
126
126
            return secondsToString();
127
127
        }
 
128
        default:
 
129
            break;
128
130
        }
129
131
        return super.toString();
130
132
    }
149
151
    private String nanoToString() {
150
152
        final long timestamp = getValue();
151
153
        StringBuilder retVal = new StringBuilder();
152
 
        retVal.append(timestamp);
153
 
        retVal.append(" ns"); //$NON-NLS-1$
 
154
        String time = Long.toString(timestamp);
 
155
        for (int i = 0; i < time.length(); i++) {
 
156
            int pos = time.length() - i - 1;
 
157
            retVal.append(time.charAt(i));
 
158
            if (pos % 3 == 0) {
 
159
                retVal.append(' ');
 
160
            }
 
161
        }
 
162
        retVal.append("ns"); //$NON-NLS-1$
154
163
        return retVal.toString();
155
164
    }
156
165