Commit 5cc2a6e7 authored by Timothy Stack's avatar Timothy Stack

Use SimpleDateFormat for the battery update time, since it wasn't

prepending zeros on times like "11:8:59".  Change the "baseurl"
parameter to "floorurl", since "baseurl" seems magical (atleast on OS
X it is).
parent a37f4e8d
...@@ -33,6 +33,9 @@ public class RoboTrack extends JApplet { ...@@ -33,6 +33,9 @@ public class RoboTrack extends JApplet {
double pixels_per_meter = 1.0; double pixels_per_meter = 1.0;
boolean frozen = false; boolean frozen = false;
static final DecimalFormat FORMATTER = new DecimalFormat("0.00"); static final DecimalFormat FORMATTER = new DecimalFormat("0.00");
static final SimpleDateFormat TIME_FORMAT =
new SimpleDateFormat("hh:mm:ss");
static final Date now = new Date();
String uid, auth; String uid, auth;
boolean shelled = false; boolean shelled = false;
...@@ -53,7 +56,7 @@ public class RoboTrack extends JApplet { ...@@ -53,7 +56,7 @@ public class RoboTrack extends JApplet {
uid = this.getParameter("uid"); uid = this.getParameter("uid");
auth = this.getParameter("auth"); auth = this.getParameter("auth");
pipeurl = this.getParameter("pipeurl"); pipeurl = this.getParameter("pipeurl");
baseurl = this.getParameter("baseurl"); baseurl = this.getParameter("floorurl");
pixels_per_meter = Double.parseDouble(this.getParameter("ppm")); pixels_per_meter = Double.parseDouble(this.getParameter("ppm"));
// form the URL that we use to get the background image // form the URL that we use to get the background image
...@@ -200,7 +203,7 @@ public class RoboTrack extends JApplet { ...@@ -200,7 +203,7 @@ public class RoboTrack extends JApplet {
// Indexed by the robot physical name, points Robot struct above. // Indexed by the robot physical name, points Robot struct above.
Dictionary robots = new Hashtable(); Dictionary robots = new Hashtable();
// Map from integer index to a Robot struct. // Map from integer index to a Robot struct.
Vector robotmap = new Vector(10, 10);; Vector robotmap = new Vector(10, 10);
int robotcount = 0; int robotcount = 0;
private class Map extends JPanel implements Runnable { private class Map extends JPanel implements Runnable {
...@@ -260,7 +263,6 @@ public class RoboTrack extends JApplet { ...@@ -260,7 +263,6 @@ public class RoboTrack extends JApplet {
*/ */
public void parseRobot(String str) { public void parseRobot(String str) {
StringTokenizer tokens = new StringTokenizer(str, ","); StringTokenizer tokens = new StringTokenizer(str, ",");
Calendar Now = new GregorianCalendar();
String tmp; String tmp;
Robot robbie; Robot robbie;
int index; int index;
...@@ -343,9 +345,9 @@ public class RoboTrack extends JApplet { ...@@ -343,9 +345,9 @@ public class RoboTrack extends JApplet {
else else
robbie.battery_voltage = ""; robbie.battery_voltage = "";
robbie.last_update = Now.getTimeInMillis(); robbie.last_update = System.currentTimeMillis();
robbie.update_string = Now.get(Calendar.HOUR_OF_DAY) + ":" + now.setTime(robbie.last_update);
Now.get(Calendar.MINUTE) + ":" + Now.get(Calendar.SECOND); robbie.update_string = TIME_FORMAT.format(now);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment