Here you can find the source of toSecondsPrecisionInMs(long ms)
Parameter | Description |
---|---|
ms | time that needs to be parsed |
public static long toSecondsPrecisionInMs(long ms)
//package com.java2s; /**/* w w w .ja v a 2 s . c om*/ * Copyright 2016 LinkedIn Corp. All rights reserved. * * 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. */ public class Main { /** * Reduces the precision of a time in milliseconds to seconds precision. Result returned is in milliseconds with last * three digits 000. Useful for comparing times kept in milliseconds that get converted to seconds and back (as is * done with HTTP date format). * * @param ms time that needs to be parsed * @return milliseconds with seconds precision (last three digits 000). */ public static long toSecondsPrecisionInMs(long ms) { return ms - (ms % 1000); } }