Here you can find the source of currentTimeMillis()
public static synchronized long currentTimeMillis()
//package com.java2s; //License from project: Apache License public class Main { private static long timeCorrection; private static long lastTimeUpdate; public static synchronized long currentTimeMillis() { long l = System.currentTimeMillis(); if (l < lastTimeUpdate) timeCorrection += lastTimeUpdate - l; lastTimeUpdate = l;// w w w .j a v a 2 s . co m return l + timeCorrection; } }