From 040b084f04778c2a1550fe865e5348f421307c02 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 15 Jan 2013 20:00:31 +1300 Subject: [PATCH] Convert speed to knots (fix #8) --- src/org/traccar/client/Protocol.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/org/traccar/client/Protocol.java b/src/org/traccar/client/Protocol.java index 0481f4f..1b94c5d 100644 --- a/src/org/traccar/client/Protocol.java +++ b/src/org/traccar/client/Protocol.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2012 - 2013 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,8 @@ public class Protocol { f.format("%02d%07.4f,%c,", (int) Math.abs(lat), Math.abs(lat) % 1 * 60, lat < 0 ? 'S' : 'N' ); f.format("%03d%07.4f,%c,", (int) Math.abs(lon), Math.abs(lon) % 1 * 60, lon < 0 ? 'W' : 'E' ); - f.format("%.2f,%.2f,", l.getSpeed(), l.getBearing()); + double speed = l.getSpeed() * 1.943844; // speed in knots + f.format("%.2f,%.2f,", speed, l.getBearing()); f.format("%1$td%1$tm%1$ty,,", l.getTime()); byte checksum = 0;