I made a little program to test the System.currentTimeMillis (). And I have a strange result. This is my logs :
1 26-12-09 20:48:21 - [Log] lTime = 1261860501
We once saw a similar thing, running on Ubuntu with AMD64x2 chips. If you also have the chip that is where I would start looking.
System.currentTimeMillis()
is dependent on System clock. It looks like the system clock has been micro-corrected by an external programme, for Linux that's probably NTP.
Note you shouldn't use System.currentTimeMillis()
to measure elapsed time. It's better to use System.nanoTime()
but even that isn't guaranteed to be monotonic.
The method in question depends on the system clock and system clocks can have problems. See http://support.ntp.org/bin/view/Support/KnownOsIssues for a discussion of issues keeping the system clock accurate via the ntpd(8) daemon.
I also recommend http://www.vmware.com/pdf/vmware_timekeeping.pdf for a discussion on the accuracy of the system clock in VMWare. It also has as excellent discussion on system clocks in general.
First of all, you have a little typo, it's 73 milliseconds, not seconds ( would be disturbing then :-) ).
To get to the point, you should be aware that Java is a very high-level language with access to system functions only provided to you through native function calls. These calls are implemented by your Virtual Machine, and there are quite a few ( Sun, Open, Dalvik.. ), so general advice can't be given, but the return time currentTimeMillis is depending on a lot of stuff, like Threading ( in the VM as well as native threads ), the resolution of the onboard timer etc. I admit that the results are strange, but unless you are highly dependent on their correct order, I wouldn't bother and just live with an anomaly in the range of a tenth of a second.
If you need more specific advice, please paste some of your source code!
Edit:
After having seen your source, I'm quite sure that your Log function uses some kind of priority processing, or threading, that leads to false results. Just try to assign the return value of the method in question and pass that variable to your log:
long foo = System.currentTimeMillis();
setLog(foo);