开发者

Division of numbers

开发者 https://www.devze.com 2023-03-02 10:34 出处:网络
I could see in Timesta开发者_运维技巧mp class, the constructor goes like: public Timestamp(long time) {

I could see in Timesta开发者_运维技巧mp class, the constructor goes like:

    public Timestamp(long time) {
    super((time/1000)*1000);
    ....................

What Im not understanding is, what is the need of dividing the time by 1000 and then multiplying again by 1000. What difference will it make? Isn't this piece redundant?


That's a way of truncating to the next lower multiple of 1000 milliseconds -- i.e., to the whole second. It's not necessarily the best way, but it's a way.

0

精彩评论

暂无评论...
验证码 换一张
取 消