aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-05-12 04:42:31 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-05-12 04:42:31 +1200
commit832d448a68eaed31e8a86c7b0d4fce169b51bc4d (patch)
tree51e5db78835c73199a9c935954625f28fae134e4 /src/org/traccar
parentdd32e2d8d149f1394ac79d5178ad365892e7df76 (diff)
downloadtrackermap-server-832d448a68eaed31e8a86c7b0d4fce169b51bc4d.tar.gz
trackermap-server-832d448a68eaed31e8a86c7b0d4fce169b51bc4d.tar.bz2
trackermap-server-832d448a68eaed31e8a86c7b0d4fce169b51bc4d.zip
Small clear history refactoring
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/database/DataManager.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index 2aeb759f6..2f2cf1275 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -311,11 +311,12 @@ public class DataManager {
public void clearHistory() throws SQLException {
long historyDays = config.getInteger("database.historyDays");
if (historyDays != 0) {
+ Date timeLimit = new Date(System.currentTimeMillis() - historyDays * 24 * 3600 * 1000);
QueryBuilder.create(dataSource, getQuery("database.deletePositions"))
- .setDate("serverTime", new Date(System.currentTimeMillis() - historyDays * 24 * 3600 * 1000))
+ .setDate("serverTime", timeLimit)
.executeUpdate();
QueryBuilder.create(dataSource, getQuery("database.deleteEvents"))
- .setDate("serverTime", new Date(System.currentTimeMillis() - historyDays * 24 * 3600 * 1000))
+ .setDate("serverTime", timeLimit)
.executeUpdate();
}
}