diff options
author | HÃ¥kon Hallingstad <hakon@oath.com> | 2018-01-23 10:08:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-23 10:08:26 +0100 |
commit | 41f9201a847e9b7aeb9641950db220dba0ab38bf (patch) | |
tree | df8c064cfe520034207333c222e67b64e3509029 /jdisc_core | |
parent | 446c42d02f86780cc0626e29eddab56be33d50e3 (diff) |
Revert "Revert "Redefine task and its context""
Diffstat (limited to 'jdisc_core')
-rw-r--r-- | jdisc_core/src/main/java/com/yahoo/jdisc/Timer.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/Timer.java b/jdisc_core/src/main/java/com/yahoo/jdisc/Timer.java index c94ebc1ab93..f0dc26844e7 100644 --- a/jdisc_core/src/main/java/com/yahoo/jdisc/Timer.java +++ b/jdisc_core/src/main/java/com/yahoo/jdisc/Timer.java @@ -4,6 +4,8 @@ package com.yahoo.jdisc; import com.google.inject.ImplementedBy; import com.yahoo.jdisc.core.SystemTimer; +import java.time.Instant; + /** * <p>This class provides access to the current time in milliseconds, as viewed by the {@link Container}. Inject an * instance of this class into any component that needs to access time, instead of using @@ -27,4 +29,10 @@ public interface Timer { */ long currentTimeMillis(); + /** + * Convenience method for getting an java.util.Instance from currentTimeMillis(). + */ + default Instant currentTime() { + return Instant.ofEpochMilli(currentTimeMillis()); + } } |