jTracer  1.03
Stack trace visualization tool
void org.libcsdbg.jtracer.TraceBar.setTimestamp ( Long  microtm)

Set the trace timestamp field.

Parameters
[in]microtmthe timestamp (in microseconds)
Todo:
Use locales to output dates

Definition at line 101 of file TraceBar.java.

102  {
103  JLabel field = fields.get("timestamp");
104 
105  Calendar c = Calendar.getInstance();
106  c.setTimeInMillis(microtm / 1000);
107 
108  int d1 = c.get(Calendar.DATE);
109  int d2 = c.get(Calendar.MONTH) + 1;
110  int d3 = c.get(Calendar.YEAR);
111 
112  String text = "";
113  text += ((d1 < 10) ? "0" : "") + d1 + "/";
114  text += ((d2 < 10) ? "0" : "") + d2 + "/" + d3 + " ";
115 
116  int h1 = c.get(Calendar.HOUR);
117  int h2 = c.get(Calendar.MINUTE);
118  int h3 = c.get(Calendar.SECOND);
119 
120  text += ((h1 < 10) ? "0" : "") + h1 + ":";
121  text += ((h2 < 10) ? "0" : "") + h2 + ":";
122  text += ((h3 < 10) ? "0" : "") + h3;
123 
124  field.setText(text);
125  }