format: adjust time values in popup
This commit is contained in:
parent
4ebbe83b2e
commit
af98176b7c
|
@ -6,20 +6,23 @@ import seconds2dmhs from '../../utils/seconds2dhms';
|
|||
import getRouteType from '../../utils/gtfs-route-type';
|
||||
|
||||
const PopupMsg = ({index,message,ptByIfleet}) => {
|
||||
const vehicleAge=seconds2dmhs(Math.round(((Date.now()-message.tsMsgCreationVehicle*1000)/1000).toFixed(0)));
|
||||
const itcsAge=seconds2dmhs(Math.round(((Date.now()-message.tsMsgCreationItcs*1000)/1000).toFixed(0)));
|
||||
const clientAge=seconds2dmhs(Math.round(((Date.now()-message.tsMsgReception*1000)/1000).toFixed(0)));
|
||||
/*get number of ms since epoch*/
|
||||
const nowTsMs=Date.now();
|
||||
const nowTs=Math.round(nowTsMs/1000);
|
||||
|
||||
const itcsTs=message.tsMsgCreationItcs;
|
||||
const itcsTsMs=itcsTs*1000;
|
||||
const itcsAge=seconds2dmhs(Math.round(nowTs-itcsTs));
|
||||
const itcsDate=new Date(itcsTsMs);
|
||||
const itcsString=itcsDate.toString()
|
||||
return (
|
||||
<>
|
||||
<Popup
|
||||
index={index}
|
||||
key={index}
|
||||
>
|
||||
id: {message.id} <br/>
|
||||
message id: {message.id} <br/>
|
||||
vehicle id: {message.vehicleId} <br/>
|
||||
creation time at vehicle: ts:{message.tsMsgCreationVehicle}, age:{vehicleAge} <br/>
|
||||
creation time at ITCS: ts:{message.tsMsgCreationItcs}, age:{itcsAge} <br/>
|
||||
reception time at client: ts:{message.tsMsgReception}, age:{clientAge} <br/>
|
||||
trip id: {ptByIfleet.trip_id} <br/>
|
||||
trip name: {ptByIfleet.trip_short_name} <br/>
|
||||
trip destination: {ptByIfleet.trip_headsign} <br/>
|
||||
|
@ -31,6 +34,8 @@ const PopupMsg = ({index,message,ptByIfleet}) => {
|
|||
agency URL: {ptByIfleet.agency_url} <br/>
|
||||
lat: {message.lat} <br/>
|
||||
lon: {message.lon} <br/>
|
||||
<br/>
|
||||
GTFS Realtime age: {itcsAge} <br/>
|
||||
</Popup>
|
||||
</>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue