2016-07-31 22:00:46 +08:00
|
|
|
package customskinloader.utils;
|
|
|
|
|
|
|
|
|
|
public class TimeUtil {
|
2018-02-12 12:20:28 +08:00
|
|
|
public static long getCurrentUnixTimestamp(){
|
2018-06-25 00:34:32 +08:00
|
|
|
return System.currentTimeMillis() / 1000L;
|
2018-02-12 12:20:28 +08:00
|
|
|
}
|
|
|
|
|
public static long getUnixTimestamp(long offset){
|
|
|
|
|
return getCurrentUnixTimestamp()+offset;
|
|
|
|
|
}
|
|
|
|
|
public static long getUnixTimestampRandomDelay(long offset){
|
|
|
|
|
return getCurrentUnixTimestamp()+offset+random(0,5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static int random(int min,int max){
|
|
|
|
|
return (int)(Math.random()*(max-min+1))+min;
|
|
|
|
|
}
|
2016-07-31 22:00:46 +08:00
|
|
|
}
|