Class SysTime

java.lang.Object
javacardx.framework.time.SysTime

public final class SysTime extends Object
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 Type
    Method
    Description
    static void
    Get an estimate of time elapsed since system boot with microsecond resolution and update the output uptime parameter.

    Methods inherited from class Object

    equals
    Modifier and Type
    Method
    Description
    boolean
    Compares two Objects for equality.
  • Method Details

    • uptime

      public static void uptime(TimeDuration uptime)
      Get an estimate of time elapsed since system boot with microsecond resolution and update the output uptime parameter.

      Note: uptime may 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 the uptime parameter is null