Java Second advanceCurrentTimeSeconds()

Here you can find the source of advanceCurrentTimeSeconds()

Description

Wait until the System#currentTimeMillis / 1000 advances.

License

Open Source License

Declaration

public static void advanceCurrentTimeSeconds()
        throws InterruptedException 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

public class Main {
    /**/*ww  w.j  a va 2 s  .c  om*/
     * Wait until the {@link System#currentTimeMillis} / 1000 advances.
     *
     * This method takes 0-1000ms to run, 500ms on average.
     */
    public static void advanceCurrentTimeSeconds()
            throws InterruptedException {
        long currentTimeSeconds = System.currentTimeMillis() / 1000;
        do {
            Thread.sleep(50);
        } while (currentTimeSeconds == System.currentTimeMillis() / 1000);
    }
}

Related

  1. addSecond(Date beginDate, int addcount)
  2. addSeconds(Date date, int m)
  3. addTimes(String dateTime, int second)
  4. appendSeconds(StringBuilder time, long seconds)
  5. appendSecondsToEncodeOutput(StringBuilder sb, int sec, int fsec, int precision, boolean fillzeros)
  6. asStringInSeconds(long duration)
  7. bytesPerSecond(long totalByteCount, long elapsed)