com.emarsys.ecommon.time
Interface Time

All Known Implementing Classes:
MockTime, SystemTime

public interface Time

Time - nomen est omen - defines the current time by providing it in milliseconds.

Time is used to circumvent the problem that time in Java is defined by the singleton System, see System.currentTimeMillis() which cannot be altered (unless you're doing some bytecode manipulation or aspect black magic). But there's a strong need to manipulate the current time for unit testing purposes which should take effect immediately.

Every class that links to eCommon and needs to get the current time should use currentTimeMillis() and not System's corresponing method.

Author:
Michael "kULO" Kulovits
See Also:
TimeBuilder

Method Summary
 long currentTimeMillis()
           Returns the current time in milliseconds.
 

Method Detail

currentTimeMillis

long currentTimeMillis()

Returns the current time in milliseconds.

Subsequent calls to currentTimeMillis() must not return values that are smaller then previous ones.

Returns:
the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.


Copyright © 2010 emarsys AG. All Rights Reserved.