How about System.currentTimeMillis()
?
From the JavaDoc:
Returns: the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC
Java 8 introduces the java.time
framework, particularly the Instant
class which "...models a ... point on the time-line...":
long now = Instant.now().toEpochMilli();
Returns: the number of milliseconds since the epoch of 1970-01-01T00:00:00Z -- i.e. pretty much the same as above :-)
Cheers,