Skip to content

Commit

Permalink
use server's current time to estimate in-flight observation time
Browse files Browse the repository at this point in the history
  • Loading branch information
dernasherbrezon committed Aug 2, 2024
1 parent 2d09f22 commit 92cc55c
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public ModelAndView doGet(IHTTPSession session) {
List<Observation> observations = resultDao.findAll();
Collections.sort(observations, ObservationFullComparator.INSTANCE);
JsonArray satellites = new JsonArray();
long currentTime = System.currentTimeMillis();
for (Observation cur : observations) {
JsonObject curObservation = new JsonObject();
curObservation.add("id", cur.getId());
Expand All @@ -42,6 +43,9 @@ public ModelAndView doGet(IHTTPSession session) {
}
curObservation.add("start", cur.getStartTimeMillis());
curObservation.add("end", cur.getEndTimeMillis());
// properly calculate remaining time on the client side
// client side (browser) and server can have different time
curObservation.add("currentTime", currentTime);
curObservation.add("status", cur.getStatus().name());
if (cur.getNumberOfDecodedPackets() != null) {
curObservation.add("numberOfDecodedPackets", cur.getNumberOfDecodedPackets());
Expand Down

0 comments on commit 92cc55c

Please sign in to comment.