aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-01 10:16:58 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-01 10:16:58 +1300
commit8550dc61aa70fea96cc73fc57969b8e0c4fab339 (patch)
treec07b1b7ac5c4f56e87e667a7d85ada48907fb821
parent9034cd07e95320a37a0f788ee6eaa546af5f4df1 (diff)
downloadtraccar-server-8550dc61aa70fea96cc73fc57969b8e0c4fab339.tar.gz
traccar-server-8550dc61aa70fea96cc73fc57969b8e0c4fab339.tar.bz2
traccar-server-8550dc61aa70fea96cc73fc57969b8e0c4fab339.zip
Replace object with system method
-rw-r--r--src/org/traccar/database/DataManager.java4
-rw-r--r--src/org/traccar/protocol/CastelProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/NavigilProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/TaipProtocolDecoder.java2
-rw-r--r--test/org/traccar/helper/DecoderVerifier.java2
5 files changed, 6 insertions, 6 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index 7bcfeac31..27d03ca08 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -119,7 +119,7 @@ public class DataManager implements IdentityManager {
@Override
public Device getDeviceByUniqueId(String uniqueId) throws SQLException {
- if ((new Date().getTime() - devicesLastUpdate > devicesRefreshDelay) || !devicesByUniqueId.containsKey(uniqueId)) {
+ if ((System.currentTimeMillis() - devicesLastUpdate > devicesRefreshDelay) || !devicesByUniqueId.containsKey(uniqueId)) {
devicesById.clear();
devicesByUniqueId.clear();
@@ -127,7 +127,7 @@ public class DataManager implements IdentityManager {
devicesById.put(device.getId(), device);
devicesByUniqueId.put(device.getUniqueId(), device);
}
- devicesLastUpdate = new Date().getTime();
+ devicesLastUpdate = System.currentTimeMillis();
}
return devicesByUniqueId.get(uniqueId);
diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java
index 358f6bb1d..95862cc9a 100644
--- a/src/org/traccar/protocol/CastelProtocolDecoder.java
+++ b/src/org/traccar/protocol/CastelProtocolDecoder.java
@@ -123,7 +123,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder {
response.writeShort(ChannelBuffers.swapShort(MSG_LOGIN_RESPONSE));
response.writeInt(0xFFFFFFFF);
response.writeShort(0);
- response.writeInt((int) (new Date().getTime() / 1000));
+ response.writeInt((int) (System.currentTimeMillis() / 1000));
response.writeShort(Crc.crc16Ccitt(response.toByteBuffer(0, response.writerIndex())));
response.writeByte(0x0D); response.writeByte(0x0A);
channel.write(response, remoteAddress);
diff --git a/src/org/traccar/protocol/NavigilProtocolDecoder.java b/src/org/traccar/protocol/NavigilProtocolDecoder.java
index 2b75e7840..7938fd7cc 100644
--- a/src/org/traccar/protocol/NavigilProtocolDecoder.java
+++ b/src/org/traccar/protocol/NavigilProtocolDecoder.java
@@ -70,7 +70,7 @@ public class NavigilProtocolDecoder extends BaseProtocolDecoder {
header.writeShort(0);
header.writeShort(Crc.crc16X25Ccitt(data.toByteBuffer()));
header.writeInt(0);
- header.writeInt((int) (new Date().getTime() / 1000) + LEAP_SECONDS_DELTA);
+ header.writeInt((int) (System.currentTimeMillis() / 1000) + LEAP_SECONDS_DELTA);
if (channel != null) {
channel.write(ChannelBuffers.copiedBuffer(header, data));
diff --git a/src/org/traccar/protocol/TaipProtocolDecoder.java b/src/org/traccar/protocol/TaipProtocolDecoder.java
index 8c1448193..252f4e712 100644
--- a/src/org/traccar/protocol/TaipProtocolDecoder.java
+++ b/src/org/traccar/protocol/TaipProtocolDecoder.java
@@ -75,7 +75,7 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
long millis = time.getTimeInMillis() + seconds * 1000;
- long diff = new Date().getTime() - millis;
+ long diff = System.currentTimeMillis() - millis;
if (diff > 12 * 60 * 60 * 1000) {
millis += 24 * 60 * 60 * 1000;
diff --git a/test/org/traccar/helper/DecoderVerifier.java b/test/org/traccar/helper/DecoderVerifier.java
index 4761ba03a..17b4f9633 100644
--- a/test/org/traccar/helper/DecoderVerifier.java
+++ b/test/org/traccar/helper/DecoderVerifier.java
@@ -13,7 +13,7 @@ public class DecoderVerifier {
assertNotNull(position.getFixTime());
assertTrue(position.getFixTime().after(new Date(946684800000L))); // 2000 year
- assertTrue(position.getFixTime().getTime() < new Date().getTime() + 3600000); // 1 hour from now
+ assertTrue(position.getFixTime().getTime() < System.currentTimeMillis() + 3600000); // 1 hour from now
assertNotNull(position.getValid());