public interface TimeService
extends com.google.common.util.concurrent.Service
Modifier and Type | Method and Description |
---|---|
void |
addTimeListener(listener : TimeListener)
Add listener on time changes.
|
boolean |
evolveTimeIfPossible([timeDelta : double])
Do a time evolution if the underlying service allows this action.
|
double |
fromOSDuration(timeDuration : double)
Convert the given duration from the operating system time scale to the agent system time scale.
|
double |
fromOSTime(timeValue : double)
Convert the given time from the operating system time scale to the agent system time scale.
|
long |
getOSCurrentTime()
Replies the OS current time.
|
double |
getOSTimeFactor()
Replies the scaling factor between the agent time and the operating system time.
|
double |
getTime(timeUnit : TimeUnit)
Replies the current time.
|
TimeUnit |
getTimePrecision()
Replies the precision of the time that is assumed by this manager.
|
void |
removeTimeListener(listener : TimeListener)
Remove listener on time changes.
|
boolean |
setTimeIfPossible(time : double)
Change the time.
|
double |
toOSDuration(timeDuration : double)
Convert the given duration from the agent system time scale to the operating system time scale.
|
double |
toOSTime(timeValue : double)
Convert the given time from the agent system time scale to the operating system time scale.
|
@Pure
def
getTime(timeUnit : TimeUnit) : double
TimeService
timeUnit
- if present, specifies the time unit of the value to reply. By default is it seconds.@Pure
def
getOSCurrentTime() : long
TimeService
@Pure
def
getOSTimeFactor() : double
TimeService
Consider time in the agent application. It may evolves at a different rate than the operating system time. The value that is replied by this function permits to determine the proportionally between the agent application time and the operating system time. A typical equation for representing this relation is: os time = OSTimeFactor * agent time.
def
fromOSDuration(timeDuration : double) : double
TimeService
TimeService.getOSTimeFactor()
for converting the duration.timeDuration
- the duration for the operating system.def
fromOSTime(timeValue : double) : double
TimeService
TimeService.getOSTimeFactor()
for converting the duration.timeValue
- the time for the operating system.@Pure
def
toOSDuration(timeDuration : double) : double
TimeService
TimeService.getOSTimeFactor()
for converting the duration.timeDuration
- the duration for the agent system.@Pure
def
toOSTime(timeValue : double) : double
TimeService
TimeService.getOSTimeFactor()
for converting the time.timeValue
- the time for the agent system.@Pure
def
getTimePrecision() : TimeUnit
TimeService
Any duration that is below the time precision is ignored.
null
.def
evolveTimeIfPossible([timeDelta : double]) : boolean
TimeService
timeDelta
- is the amount of time to consider for the evolution. If it is negative or zero,
a default amount will be selected by the time service.true
if time has evolved. Otherwise false
.def
setTimeIfPossible(time : double) : boolean
TimeService
time
- the new time.true
if time has evolved. Otherwise false
.def
addTimeListener(listener : TimeListener) : void
TimeService
listener
- the listener.def
removeTimeListener(listener : TimeListener) : void
TimeService
listener
- the listener.Copyright © 2021 the original authors or authors.