7The Real-Time Clock API

“All my possessions for a moment of time.”

—Elizabeth I

THIS chapter explores the implementation of the RTSJ definition of clocks and timers within Java RTS. The classes explored in detail provide jitter-free time operations, and access to a high-resolution clock for timer objects for different types of timers. For instance, you can create timer objects that cause time-related events to fire either periodically, or for one-time use.

The Clock API

Java RTS implements the RTSJ Clock API, which defines real-time clock and timer facilities. These classes should be used in place of calls to System.currentTimeMillis, System.nanoTime, and the java.util.Date class. They represent points in time with the best possible accuracy ...

Get Real-Time Java™ Programming with Java RTS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.