aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/MainEventHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/MainEventHandler.java')
-rw-r--r--src/org/traccar/MainEventHandler.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/org/traccar/MainEventHandler.java b/src/org/traccar/MainEventHandler.java
index 81376724b..37f0ee387 100644
--- a/src/org/traccar/MainEventHandler.java
+++ b/src/org/traccar/MainEventHandler.java
@@ -25,6 +25,7 @@ import org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler;
import org.jboss.netty.handler.timeout.IdleStateEvent;
import org.traccar.helper.Log;
import org.traccar.model.Position;
+import java.text.SimpleDateFormat;
public class MainEventHandler extends IdleStateAwareChannelHandler {
@@ -39,14 +40,15 @@ public class MainEventHandler extends IdleStateAwareChannelHandler {
StringBuilder s = new StringBuilder();
s.append(formatChannel(e.getChannel())).append(" ");
s.append("id: ").append(position.getDeviceId()).append(", ");
- s.append("time: ").append(position.getFixTime()).append(", ");
- s.append("lat: ").append(position.getLatitude()).append(", ");
- s.append("lon: ").append(position.getLongitude()).append(", ");
- s.append("speed: ").append(position.getSpeed()).append(", ");
- s.append("course: ").append(position.getCourse());
+ s.append("time: ").append(
+ new SimpleDateFormat(Log.DATE_FORMAT).format(position.getFixTime())).append(", ");
+ s.append("lat: ").append(String.format("%.5f", position.getLatitude())).append(", ");
+ s.append("lon: ").append(String.format("%.5f", position.getLongitude())).append(", ");
+ s.append("speed: ").append(String.format("%.1f", position.getSpeed())).append(", ");
+ s.append("course: ").append(String.format("%.1f", position.getCourse()));
Log.info(s.toString());
- Context.getConnectionManager().update(position);
+ Context.getConnectionManager().updatePosition(position);
}
}