Java TimeUnit Calculate getBase(final TimeUnit unit)

Here you can find the source of getBase(final TimeUnit unit)

Description

get Base

License

Apache License

Declaration

private static long getBase(final TimeUnit unit) 

Method Source Code

//package com.java2s;
/*//from w w w .  j  a v a2 s  .com
 * Copyright (C) 2008 The Guava Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import static java.util.concurrent.TimeUnit.NANOSECONDS;

import java.util.concurrent.TimeUnit;

public class Main {
    private static long getBase(final TimeUnit unit) {
        return NANOSECONDS.convert(1, unit);
    }
}

Related

  1. dateIn(long distance, TimeUnit unit)
  2. deepSleep(long sleepFor, TimeUnit unit)
  3. delayQuietly(final long time, final TimeUnit unit)
  4. diff(Date earlier, Date later, TimeUnit timeUnit)
  5. differenceBetween(Date initDate, Date endDate, TimeUnit units)
  6. getBucketInMillis(int bucketSize, TimeUnit bucketUnit)
  7. getComingTime(Integer delta, TimeUnit unit)
  8. getDate(final TimeUnit unit, final int offset)
  9. getDateDiff(Date date1, Date date2, TimeUnit timeUnit)