List of usage examples for java.time ZonedDateTime minusSeconds
public ZonedDateTime minusSeconds(long seconds)
From source file:Main.java
public static void main(String[] args) { ZonedDateTime dateTime = ZonedDateTime.now(); ZonedDateTime n = dateTime.minusSeconds(1234); System.out.println(n);//from w ww . j a v a 2s . c o m }
From source file:io.stallion.services.DynamicSettings.java
public void checkLoadUpdated(ZonedDateTime now) { if (!dbAvailable) { return;/* w w w. jav a 2s . com*/ } if (lastSyncAt == null || lastSyncAt.isBefore(now.minusSeconds(90))) { synchronized (this) { if (lastSyncAt == null || lastSyncAt.isBefore(now.minusSeconds(90))) { ZonedDateTime since = lastSyncAt; loadUpdated(since); lastSyncAt = now; } } } }
From source file:nu.yona.server.analysis.service.AnalysisEngineServiceTest.java
@Test public void analyze_appActivityOverlappingLastCachedActivityBeginAndEnd_updateTimeLastActivity() { ZonedDateTime now = now(); JUnitUtil.skipBefore("Skip shortly after midnight", now, 0, 20); ZonedDateTime existingActivityStartTime = now.minusMinutes(5); ZonedDateTime existingActivityEndTime = now.minusSeconds(15); mockExistingActivity(gamblingGoal, existingActivityStartTime, existingActivityEndTime, "Poker App"); ZonedDateTime startTime = now.minusMinutes(10); ZonedDateTime endTime = now;/* ww w . ja v a2 s. c om*/ service.analyze(userAnonId, deviceAnonId, createSingleAppActivity("Poker App", startTime, endTime)); verify(mockActivityUpdater).updateTimeLastActivity(any(), eq(GoalDto.createInstance(gamblingGoal)), any()); verify(mockActivityUpdater, never()).updateTimeExistingActivity(any(), any()); verify(mockActivityUpdater, never()).addActivity(any(), any(), any(), any()); }
From source file:nu.yona.server.analysis.service.AnalysisEngineServiceTest.java
@Test public void analyze_appActivityOverlappingLastCachedActivityBeginOnly_updateTimeLastActivity() { ZonedDateTime now = now(); JUnitUtil.skipBefore("Skip shortly after midnight", now, 0, 11); ZonedDateTime existingActivityStartTime = now.minusMinutes(5); ZonedDateTime existingActivityEndTime = now.minusSeconds(15); mockExistingActivity(gamblingGoal, existingActivityStartTime, existingActivityEndTime, "Poker App"); ZonedDateTime startTime = now.minusMinutes(10); ZonedDateTime endTime = existingActivityEndTime.minusMinutes(2); service.analyze(userAnonId, deviceAnonId, createSingleAppActivity("Poker App", startTime, endTime)); verify(mockActivityUpdater).updateTimeLastActivity(any(), eq(GoalDto.createInstance(gamblingGoal)), any()); verify(mockActivityUpdater, never()).updateTimeExistingActivity(any(), any()); verify(mockActivityUpdater, never()).addActivity(any(), any(), any(), any()); }