@Test public void testGetFirstTileTime() { ScheduledTime t = new ScheduledTime("2015-09-02T20:19:23Z"); Assert.assertEquals(new ScheduledTime("2015-09-02T00:00Z"), UIServlet.getFirstTileTime(t, 60*24)); Assert.assertEquals(new ScheduledTime("2015-09-02T18:00Z"), UIServlet.getFirstTileTime(t, 60*6)); Assert.assertEquals(new ScheduledTime("2015-09-02T20:00Z"), UIServlet.getFirstTileTime(t, 60*2)); Assert.assertEquals(new ScheduledTime("2015-09-02T20:00Z"), UIServlet.getFirstTileTime(t, 60)); Assert.assertEquals(new ScheduledTime("2015-09-02T20:15Z"), UIServlet.getFirstTileTime(t, 15)); Assert.assertEquals(new ScheduledTime("2015-09-02T20:15Z"), UIServlet.getFirstTileTime(t, 5)); Assert.assertEquals(new ScheduledTime("2015-09-02T20:19Z"), UIServlet.getFirstTileTime(t, 1)); Assert.assertEquals(new ScheduledTime("2015-09-02T00:00Z"), UIServlet.getFirstTileTime(new ScheduledTime("2015-09-02T00:00Z"), 60*24)); }
static ScheduledTime getFirstTileTime(ScheduledTime now, int zoomLevelMinutes) { DateTime dt = now.getDateTime(); DateTime nextDay = toFullDay(dt.plusDays(1)); DateTime t = nextDay; while(t.isAfter(dt)) { t = t.minusMinutes(zoomLevelMinutes); } return new ScheduledTime(t); }
UIServlet extends HttpServlet { static ScheduledTime getFirstTileTime(ScheduledTime now, int zoomLevelMinutes) { DateTime dt = now.getDateTime(); DateTime nextDay = toFullDay(dt.plusDays(1)); DateTime t = nextDay; while(t.isAfter(dt)) { t = t.minusMinutes(zoomLevelMinutes); } return new ScheduledTime(t); } }
UIServlet extends HttpServlet { static ScheduledTime getFirstTileTime(ScheduledTime now, int zoomLevelMinutes) { DateTime dt = now.getDateTime(); DateTime nextDay = toFullDay(dt.plusDays(1)); DateTime t = nextDay; while(t.isAfter(dt)) { t = t.minusMinutes(zoomLevelMinutes); } return new ScheduledTime(t); }  }
UIServlet extends HttpServlet { static ScheduledTime getFirstTileTime(ScheduledTime now, int zoomLevelMinutes) { DateTime dt = now.getDateTime(); DateTime nextDay = toFullDay(dt.plusDays(1)); DateTime t = nextDay; while(t.isAfter(dt)) { t = t.minusMinutes(zoomLevelMinutes); } return new ScheduledTime(t); }   }
UIServlet extends HttpServlet { static ScheduledTime getFirstTileTime(ScheduledTime now, int zoomLevelMinutes) { DateTime dt = now.getDateTime(); DateTime nextDay = toFullDay(dt.plusDays(1)); DateTime t = nextDay; while(t.isAfter(dt)) { t = t.minusMinutes(zoomLevelMinutes); } return new ScheduledTime(t); }    }