List of usage examples for org.joda.time Minutes ONE
Minutes ONE
To view the source code for org.joda.time Minutes ONE.
Click Source Link
From source file:controllers.api.DashboardsApiController.java
License:Open Source License
private Duration estimateIntervalStep(String interval) { Duration step;//from w w w. jav a2 s .c o m switch (interval) { case "minute": step = Minutes.ONE.toStandardDuration(); break; case "hour": step = Hours.ONE.toStandardDuration(); break; case "day": step = Days.ONE.toStandardDuration(); break; case "week": step = Weeks.ONE.toStandardDuration(); break; case "month": step = Days.days(31).toStandardDuration(); break; case "quarter": step = Days.days(31 * 3).toStandardDuration(); break; case "year": step = Days.days(365).toStandardDuration(); break; default: throw new IllegalArgumentException("Invalid duration specified: " + interval); } return step; }
From source file:google.registry.loadtest.LoadTestModule.java
License:Open Source License
@Provides @Parameter("delaySeconds") static int provideDelaySeconds(HttpServletRequest req) { return extractOptionalIntParameter(req, "delaySeconds").or(Minutes.ONE.toStandardSeconds().getSeconds()); }
From source file:google.registry.loadtest.LoadTestModule.java
License:Open Source License
@Provides @Parameter("runSeconds") static int provideRunSeconds(HttpServletRequest req) { return extractOptionalIntParameter(req, "runSeconds").or(Minutes.ONE.toStandardSeconds().getSeconds()); }
From source file:net.schweerelos.timeline.model.Timeline.java
License:Open Source License
public Interval convertSliceToInterval(int row) { if (row > -1) { DateTime periodStart = start;// w ww .j av a 2 s. c o m for (int i = 0; i < row; i++) { Duration addDuration = increment.toDurationFrom(periodStart); periodStart = periodStart.plus(addDuration); } Duration addDuration = increment.toDurationFrom(periodStart); DateTime periodEnd = periodStart.plus(addDuration); if (periodEnd.isAfter(end)) { periodEnd = end; } periodEnd = periodEnd.minus(Minutes.ONE); return new Interval(periodStart, periodEnd); } else { return null; } }
From source file:org.apache.beam.sdk.io.kinesis.SimplifiedKinesisClient.java
License:Apache License
/** * Gets total size in bytes of all events that remain in Kinesis stream between specified * instants.// w w w . java 2 s .co m * * @return total size in bytes of all Kinesis events after specified instant */ public long getBacklogBytes(final String streamName, final Instant countSince, final Instant countTo) throws TransientKinesisException { return wrapExceptions(() -> { Minutes period = Minutes.minutesBetween(countSince, countTo); if (period.isLessThan(Minutes.ONE)) { return 0L; } GetMetricStatisticsRequest request = createMetricStatisticsRequest(streamName, countSince, countTo, period); long totalSizeInBytes = 0; GetMetricStatisticsResult result = cloudWatch.getMetricStatistics(request); for (Datapoint point : result.getDatapoints()) { totalSizeInBytes += point.getSum().longValue(); } return totalSizeInBytes; }); }
From source file:org.hawkular.metrics.scheduler.api.RepeatingTrigger.java
License:Apache License
private RepeatingTrigger(Long triggerTime, Long interval, Long delay, Integer repeatCount) { if (triggerTime != null) { this.triggerTime = getTimeSlice(triggerTime, standardMinutes(1)); } else if (interval == null && delay == null) { this.triggerTime = currentMinute().plusMinutes(1).getMillis(); }//from w ww.ja v a2s. c o m this.interval = interval; this.delay = delay == null ? Minutes.ONE.toStandardDuration().getMillis() : delay; this.repeatCount = repeatCount; this.executionCount = 1; if (this.triggerTime == null) { this.triggerTime = getTimeSlice(now.get().getMillis() + this.delay, standardMinutes(1)); } }