Class SysTime
java.lang.Object
javacardx.framework.time.SysTime
Class used to handle system time, suitable for timestamps or for estimating
intervals between events.
Example of use:
// pre-allocate 2 duration instances
TimeDuration start = TimeDuration.getInstance(JCSystem.MEMORY_TYPE_TRANSIENT_DESELECT);
TimeDuration current = TimeDuration.getInstance(JCSystem.MEMORY_TYPE_TRANSIENT_DESELECT);
// get timestamp
SysTime.uptime(start);
[...]
// get another timestamp
SysTime.uptime(current);
// compares difference with threshold and do something if required
if (current.minus(start).compareTo(100, MILLIS) >= 0) {
// More than 100ms: do something
}
- Since:
- 3.1
-
Method Summary
Modifier and TypeMethodDescriptionstatic voiduptime(TimeDuration uptime) Get an estimate of time elapsed since system boot with microsecond resolution and update the outputuptimeparameter.
-
Method Details
-
uptime
Get an estimate of time elapsed since system boot with microsecond resolution and update the outputuptimeparameter.Note:
uptimemay not accurately represent time elapsed since system boot, in particular it does not include time during sleep mode. However, it guarantees that the value is never decreased before next platform reset event.- Parameters:
uptime- updated with time elapsed since system boot - not null- Throws:
NullPointerException- if theuptimeparameter isnull
-