From 3185c02ebfbe55c867aa514d9f47a867e18a1593 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 27 Feb 2013 20:53:59 +1300 Subject: Round period to next 15 min --- src/org/traccar/web/client/view/ArchiveView.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/web/client/view/ArchiveView.java b/src/org/traccar/web/client/view/ArchiveView.java index 28291d0d..9cc579f8 100644 --- a/src/org/traccar/web/client/view/ArchiveView.java +++ b/src/org/traccar/web/client/view/ArchiveView.java @@ -132,12 +132,14 @@ public class ArchiveView implements SelectionChangedEvent.SelectionChangedHandle grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); // Initialize with current time + long min = 60 * 1000; Date now = new Date(); - Date from = new Date(now.getTime() - 60 * 60 * 1000); + Date to = new Date(((now.getTime() + 15 * min) / (15 * min)) * 15 * min); + Date from = new Date(to.getTime() - 60 * min); fromDate.setValue(from); fromTime.setValue(from); - toDate.setValue(now); - toTime.setValue(now); + toDate.setValue(to); + toTime.setValue(to); } @Override -- cgit v1.2.3