Next: , Previous: , Up: Miscellaneous   [Contents][Index]


21.7 Time-related functions

Procedure: current-second

Returns an inexact number represent the current time on the International Atomic Time (TAI) scale. The value 0.0 represents midnight on January 1, 1070 TAI (equivalent to 10 seconds before midnight Universal Time), and the value 1.0 represents on TAI second later. Neither high acuracy nor high precision are required; in particular returning Coordinated Universal Time plus a suitable constant might be the best an implementation cat do. The Kawa implementation just multiplies by 0.001 the result of calling the method currentTimeMillis in class java.lang.System.

Procedure: current-jiffy

Returns the number of jiffies as an exact integer that have elapses since an arbitrary implementation-defined epoch (instant). A jiffy is an implementation-defined fraction of a second which is defined by the return value of the jiffies-per-second procedure. The starting epoch (instant 0) is guaranteed to be constant during a run of the program, but may vary between runs. (At the time of writing, Kawa’s jiffy is one nano-second.)

Rationale: Jiffies are allowed to be implementation-dependent so that current-jiffy can execute with minimal overhead. It should be very likely that a compactly represented integer will suffice as the return value. Any particular jiffy size will be inappropriate some some implementations: a microsecond is too long for a very fast machine, while a much smaller unit would force many implementations to return integers which have to allocated for most calls, rendering current-jiffy less useful for accurate timing measurements.

Procedure: jiffies-per-second

Returns an exact integer representing the number of jiffies per SI second. This value is an implementation-specified constant. (At the time of writing, the value in Kawa is 1,000,000,000.)

Procedure: sleep time

Suspends the current thread for the specified time. The time can be either a pure number (in secords), or a quantity whose unit is a time unit (such as 10s).


Next: , Previous: , Up: Miscellaneous   [Contents][Index]