美文网首页
如何在代码中判断时间是否过了10分钟

如何在代码中判断时间是否过了10分钟

作者: Bount林 | 来源:发表于2019-05-29 16:27 被阅读0次
package com.sinosoft.huataiejia;

import com.sinosoft.huataiejia.utils.LogUtils;

/**
 * Author by linkaikai
 * Date on 2019/5/29
 */
public class A{
    private static long prevTime=0;
    private static long curTime=0;
    public static boolean check(){
        curTime=System.currentTimeMillis();
        if (prevTime>0 && ( (curTime-prevTime)>10000 )){
            prevTime=curTime;
            LogUtils.i("A","true");
            LogUtils.i("A","prevTime:"+prevTime);
            LogUtils.i("A","curTime:"+prevTime);
            return true;
        }else{
            prevTime=curTime;
            LogUtils.i("A","false");
            LogUtils.i("A","prevTime:"+prevTime);
            LogUtils.i("A","curTime:"+prevTime);
            return false;
        }
    }
}

相关文章

网友评论

      本文标题:如何在代码中判断时间是否过了10分钟

      本文链接:https://www.haomeiwen.com/subject/fdiytctx.html