Example usage for java.time.temporal ChronoUnit getDuration

List of usage examples for java.time.temporal ChronoUnit getDuration

Introduction

In this page you can find the example usage for java.time.temporal ChronoUnit getDuration.

Prototype

@Override
public Duration getDuration() 

Source Link

Document

Gets the estimated duration of this unit in the ISO calendar system.

Usage

From source file:de.qaware.chronix.solr.query.analysis.functions.transformation.Timeshift.java

/**
 * Constructs a timeshift transformation
 *
 * @param amount the amount, e.g 10//ww w.  j a  v a2 s  .  c o m
 * @param unit   the unit, e.g HOURS
 */
public Timeshift(long amount, ChronoUnit unit) {
    this.amount = amount;
    this.unit = unit;
    this.shift = unit.getDuration().toMillis() * amount;
}

From source file:de.qaware.chronix.solr.query.analysis.functions.transformation.MovingAverage.java

/**
 * Constructs a moving average transformation
 *
 * @param timeSpan the time span e.g. 5, 10
 * @param unit     the unit of the time span
 *///from ww w  . j  a  v a  2s .c  o m
public MovingAverage(long timeSpan, ChronoUnit unit) {
    this.timeSpan = timeSpan;
    this.unit = unit;
    this.windowTime = unit.getDuration().toMillis() * timeSpan;
}