aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2018-05-29 17:03:15 +0500
committerAbyss777 <abyss@fox5.ru>2018-05-29 17:03:15 +0500
commitc71701136245a63ea82a8a595dd51cc011ab2c35 (patch)
tree50f7daaa7addb539121f0309f779a14299b03438 /src/org/traccar/helper
parentb41af1b39cdaa511dbf53769342ebca5b0348931 (diff)
downloadtrackermap-server-c71701136245a63ea82a8a595dd51cc011ab2c35.tar.gz
trackermap-server-c71701136245a63ea82a8a595dd51cc011ab2c35.tar.bz2
trackermap-server-c71701136245a63ea82a8a595dd51cc011ab2c35.zip
Add units converter helper
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r--src/org/traccar/helper/UnitsConverter.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/org/traccar/helper/UnitsConverter.java b/src/org/traccar/helper/UnitsConverter.java
index 56d15e4e7..7519879c0 100644
--- a/src/org/traccar/helper/UnitsConverter.java
+++ b/src/org/traccar/helper/UnitsConverter.java
@@ -23,6 +23,7 @@ public final class UnitsConverter {
private static final double KNOTS_TO_CPS_RATIO = 0.0194384449;
private static final double METERS_TO_FEET_RATIO = 0.3048;
private static final double METERS_TO_MILE_RATIO = 1609.34;
+ private static final long MILLISECONDS_TO_HOURS_RATIO = 3600000;
private UnitsConverter() {
}
@@ -71,4 +72,12 @@ public final class UnitsConverter {
return value * METERS_TO_MILE_RATIO;
}
+ public static long millisecondsFromHours(int value) {
+ return value * MILLISECONDS_TO_HOURS_RATIO;
+ }
+
+ public static long millisecondsFromHours(double value) {
+ return (long) (value * MILLISECONDS_TO_HOURS_RATIO);
+ }
+
}