final long startTime = System.currentTimeMillis();
Thread.currentThread().sleep(10000);
final long endTime = System.currentTimeMillis();
final long time = endTime - startTime;
System.out.println(time);
final long diffSeconds = time / 1000 % 60;
final long diffMinutes = time / (60 * 1000) % 60;
final long diffHours = time / (60 * 60 * 1000);
System.out.println(diffSeconds);
System.out.println(diffMinutes);
System.out.println(diffHours);
时间: 2024-11-08 21:37:36