Jiffy Clock
The Jiffy Clock is a free-running hardware clock used as a hardware interval timer covering a day range. The Jiffy Clock value is set to zero (initialized) when the system is powered-up.
Jiffy as a time interval[edit | edit source]
In computing, a jiffy was originally the time between two ticks of the system timer interrupt[1]. Whereas in electrical engineering, a jiffy is the time between alternating current power cycles in most mains power supplies[2], but in electronics and computer engineering context this could be any short period of time. Specifically in the C64 the Jiffy Clock (accessible from BASIC by means of variables TI and TI$) is derived from the hardware timer with a clock reference based on an oscillator frequency which matches a multiple of the vertical refresh period of the national television standard. The timer interval is adjusted appropriately to give a fixed time interval of 1/60th of a second, no matter which television standard a country is using (NTSC or PAL).
Accuracy[edit | edit source]
A jiffy in the C64 is therefore not an absolute unit of time. Although the crystal's oscillator frequency is very accurate, the clock interrupt frequency is turned off during tape I/O. This notwithstanding, if the clock interrupt frequency was not turned off (for example when using the C64 as a server) then it is still inaccurate. After the clock is incremented[3], it is compared with the roll-over value $4F1A01 (or 5184001 jiffies, which is 24 hours + 1 jiffy). The counter is set to zero only if this value is reached or exceeded. The consequence of this on-off wrap-around value is that there is the loss of 1 jiffy (16.8 ms) each day.
References[edit | edit source]
- ↑ Reducing Scheduling-Clock Ticks, accessed 24 September 2014
- ↑ What’s a Jiffy?, accessed 24 September 2014
- ↑ $F69B KERNAL routine Bump Clock