17 package com.generalrobotix.ui.view.graph;
19 import java.text.DecimalFormat;
24 DecimalFormat format_ =
new DecimalFormat(
"000");
39 public Time(
int m,
int u) {
72 public void set(
Time time) {
81 public void set(
double time) {
82 long utime = (long)Math.round(time * 1000000.0);
83 usec_ = (
int)(utime % 1000);
84 msec_ = (
int)(utime / 1000);
87 public void set(
float time) {
88 long utime = (long)Math.round((
double)time * 1000000.0);
89 usec_ = (
int)(utime % 1000);
90 msec_ = (
int)(utime / 1000);
98 public void set(
int m,
int u) {
111 msec_ += usec_ / 1000;
112 usec_ = usec_ % 1000;
123 msec_ += usec_ / 1000 - 1 ;
124 usec_ = usec_ % 1000;
131 msec_ += usec_ / 1000;
132 usec_ = usec_ % 1000;
141 return (
double)msec_ * 0.001 + (double)usec_ * 0.000001;
148 return (
float)msec_ * 0.001f + (float)usec_ * 0.000001
f;
152 if ((msec_ == time.msec_) && (usec_ == time.usec_))
return true;
157 return (
long)msec_ * 1000L + (long)usec_;
161 msec_ = (
int)(utime / 1000);
162 usec_ = (
int)utime % 1000;
166 StringBuffer
buf =
new StringBuffer();
167 buf.append(String.valueOf(msec_ / 1000));
169 buf.append(format_.format(msec_ % 1000));
170 buf.append(format_.format(usec_ % 1000));
171 return buf.toString();
boolean compare(Time time)
void setUtime(long utime)