/**
* 计算耗时
* @param t 毫秒
* @return
*/
private static String getHaoShi(double t) {
double d7 = t / 1000.0 / 60 / 60 / 24 / 30 / 12 / 100;
if (d7 > 1)
return DoubleUtil.round(d7, 1) + "纪元";
double d6 = t / 1000.0 / 60 / 60 / 24 / 30 / 12;
if (d6 > 1)
return DoubleUtil.round(d6, 1) + "年";
double d5 = t / 1000.0 / 60 / 60 / 24 / 30;
if (d5 > 1)
return DoubleUtil.round(d5, 1) + "月";
double d4 = t / 1000.0 / 60 / 60 / 24;
if (d4 > 1)
return DoubleUtil.round(d4, 1) + "天";
double d3 = t / 1000.0 / 60 / 60;
if (d3 > 1)
return DoubleUtil.round(d3, 1) + "小时";
double d2 = t / 1000.0 / 60;
if (d2 > 1)
return DoubleUtil.round(d2, 1) + "分钟";
double d1 = t / 1000.0;
if (d1 > 1)
return DoubleUtil.round(d1, 1) + "秒";
return t + "毫秒";
}
DoubleUtil :https://blog.csdn.net/Lxinccode/article/details/103805431
END。