Time Service (Java Enterprise in a Nutshell) Book Home Java Enterprise in a Nutshell Search this book

11.13. Time Service

This service gives programs the ability to acquire an accurate value for the current time and an estimate of the error of the value provided. The Time Service uses a Universal Time Coordinated time representation to report time values. This representation uses time intervals of 100 nanoseconds, starting on midnight, October 15, 1582. The time reported is always relative to the Greenwich Mean Time (GMT).

The Time Service also provides facilities for generating time-based events, using timers and alarms, and for the ordering and linear positioning of events in time.

An implementation of the Time Service is responsible for communicating with an accurate time source, such as a Cesium clock or radio time broadcasts, for determining its time and error estimates.

Time is reported from a TimeService object in the form of UTO objects, which stand for universal time objects. Time intervals are given in the form of TIO objects, or time interval objects. A timer event is represented by a TimerEventT structure that includes the time the event triggered and any data that was specified to be delivered with the event. A timer event is indirectly created through the TimerEventService by registering a consumer for the event, which returns a TimerEventHandler object that can set the trigger time for the event, set the data to be delivered with the event, or cancel the event.

The timer event portion of the Time Service depends on an Event Service being available.



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.