Skip to content

Commit 316f5c1

Browse files
fix gps_time handling
1 parent c76a5a3 commit 316f5c1

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

cache.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# updated on 26-01-2013
2+
# updated on 27-01-2013
33

44
img/logo.png
55
img/marker-you.png

js/mobile.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/tracker.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ function updateVehicleInfo(index, position) {
377377
// mid for landscape
378378
var l = '<dt>'+ascent_text+'</dt><dd>rate</dd>'
379379
+ '<dt>'+position.gps_alt+'m ('+vehicles[index].max_alt+'m)</dt><dd>altitude (max)</dd>'
380-
+ '<dt>'+position.gps_time+'</dt><dd>time</dd>'
380+
+ '<dt>'+position.gps_time+'</dt><dd>datetime</dd>'
381381
+ '<dt>'+coords_text+'</dt><dd>coordinates</dd>'
382382
+ habitat_data(position.data)
383383
+ c // recievers if any
@@ -514,6 +514,7 @@ function updatePolyline(vehicle_index) {
514514

515515
function convert_time(gps_time) {
516516
// example: "2009-05-28 20:29:47"
517+
/*
517518
year = parseInt(gps_time.substring(0, 4), 10);
518519
month = parseInt(gps_time.substring(5, 7), 10);
519520
day = parseInt(gps_time.substring(8, 10), 10);
@@ -528,11 +529,14 @@ function convert_time(gps_time) {
528529
date.setUTCHours(hour);
529530
date.setUTCMinutes(minute);
530531
date.setUTCSeconds(second);
532+
*/
531533

532-
return date.getTime() / 1000; // seconds since 1/1/1970 @ 12:00 AM
534+
return (new Date(gps_time)).getTime() / 1000; // seconds since 1/1/1970 @ 12:00 AM
533535
}
534536

535537
function addPosition(position) {
538+
position.gps_time = position.gps_time.replace(/(\d+)-(\d+)-(\d+)/,"$2/$3/$1");
539+
536540
// check if the vehicle is already in the list, if not create a new item
537541
if($.inArray(position.vehicle, vehicle_names) == -1) {
538542
vehicle_names.push(position.vehicle);
@@ -931,6 +935,9 @@ function update(response) {
931935
// pan and follow that balloon
932936
followVehicle(i);
933937

938+
// expand list element
939+
$('.vehicle'+i).addClass('active');
940+
934941
// scroll list to the expanded element
935942
listScroll.refresh();
936943
listScroll.scrollToElement('.portrait .vehicle'+i);

0 commit comments

Comments
 (0)