From 68b2d3ab8897114dac8cd92618cf0777f630750a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 22 Jan 2018 18:20:50 +1300 Subject: Use consistent server time --- src/org/traccar/DefaultDataHandler.java | 2 +- src/org/traccar/database/DataManager.java | 7 ------- src/org/traccar/database/DeviceManager.java | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/DefaultDataHandler.java b/src/org/traccar/DefaultDataHandler.java index e32fe0e7d..1ac3efc77 100644 --- a/src/org/traccar/DefaultDataHandler.java +++ b/src/org/traccar/DefaultDataHandler.java @@ -24,7 +24,7 @@ public class DefaultDataHandler extends BaseDataHandler { protected Position handlePosition(Position position) { try { - Context.getDataManager().addPosition(position); + Context.getDataManager().addObject(position); } catch (Exception error) { Log.warning(error); } diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index f813426d3..1f6315d92 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -335,13 +335,6 @@ public class DataManager { .executeQuery(Position.class); } - public void addPosition(Position position) throws SQLException { - position.setId(QueryBuilder.create(dataSource, getQuery(ACTION_INSERT, Position.class), true) - .setObject(position) - .setDate("serverTime", new Date()) - .executeUpdate()); - } - public void updateLatestPosition(Position position) throws SQLException { QueryBuilder.create(dataSource, getQuery("database.updateLatestPosition")) .setDate("now", new Date()) diff --git a/src/org/traccar/database/DeviceManager.java b/src/org/traccar/database/DeviceManager.java index 4c329786f..c59061b7f 100644 --- a/src/org/traccar/database/DeviceManager.java +++ b/src/org/traccar/database/DeviceManager.java @@ -355,7 +355,7 @@ public class DeviceManager extends BaseObjectManager implements Identity Position last = positions.get(deviceTotalDistance.getDeviceId()); if (last != null) { last.getAttributes().put(Position.KEY_TOTAL_DISTANCE, deviceTotalDistance.getTotalDistance()); - getDataManager().addPosition(last); + getDataManager().addObject(last); updateLatestPosition(last); } else { throw new IllegalArgumentException(); -- cgit v1.2.3