Java Duration Calculate getDurationByTimeValues(final long hours, final long minutes, final long seconds)

Here you can find the source of getDurationByTimeValues(final long hours, final long minutes, final long seconds)

Description

converts values of time constants to a Duration object..

License

Open Source License

Parameter

Parameter Description
hours count of hours
minutes count of minutes
seconds count of seconds

Return

duration

Declaration

public static Duration getDurationByTimeValues(final long hours, final long minutes, final long seconds) 

Method Source Code

//package com.java2s;
/**//from   w  w w. j  av a2  s . c o m
 * Copyright (c) 2015 Bosch Software Innovations GmbH and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

import java.time.Duration;

public class Main {
    /**
     * converts values of time constants to a Duration object..
     * 
     * @param hours
     *            count of hours
     * @param minutes
     *            count of minutes
     * @param seconds
     *            count of seconds
     * @return duration
     */
    public static Duration getDurationByTimeValues(final long hours, final long minutes, final long seconds) {
        return Duration.ofHours(hours).plusMinutes(minutes).plusSeconds(seconds);
    }
}

Related

  1. delayedFuture(Duration delay, ScheduledExecutorService executorService)
  2. durationFromNow(TemporalAmount duration)
  3. failAfter(Duration duration)
  4. futureWithTimeout(Duration timeout, ScheduledExecutorService executorService)
  5. getDurationAsISO8601(Duration duration)
  6. getExpirationMillis(long now, Duration duration)
  7. getOrThrow(final ListenableFuture Future, final Duration timeout)
  8. getTTLSeconds(Duration duration)
  9. isDuration(String value)