o19830015 2013-02-16 02:57 采纳率: 12.5%
浏览 1860

currentTimeMillis()中4小时

有个问题,如下函数,有一个名为cachetime的参数,如何设置为4小时?设置4 * 3600000

public static File getCache(String name, Context c, int cacheTime) 
{
    if (cacheTime <= 0)
        return null;
    File cache = new File(c.getCacheDir(), name);
    long now = System.currentTimeMillis();
    if (cache.exists() && (now - cache.lastModified() < cacheTime))
        return cache;
    return null;
}
  • 写回答

1条回答 默认 最新

  • ce_la_vie 2013-02-16 05:54
    关注
    // 4 hours * 60 (min/hour) * 60 (sec/min) * 1000 (msec/sec)
    getCache(name, c, 4 * 3600 * 1000);
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 关于无人驾驶的航向角
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了