Java Second Round roundToSecond(final long pTime)

Here you can find the source of roundToSecond(final long pTime)

Description

Rounds the given time down to the closest second.

License

Open Source License

Parameter

Parameter Description
pTime time

Return

the time rounded to the closest second.

Declaration

public static long roundToSecond(final long pTime) 

Method Source Code

//package com.java2s;

public class Main {
    /** One second: 1000 milliseconds. */
    public static final long SECOND = 1000l;

    /**/*from   w  w  w. j ava2  s.c o m*/
     * Rounds the given time down to the closest second.
     *
     * @param pTime time
     * @return the time rounded to the closest second.
     */
    public static long roundToSecond(final long pTime) {
        return (pTime / SECOND) * SECOND;
    }
}

Related

  1. roundMjdToSeconds(double timeStep)
  2. roundToNearestSecond(long time)