View Single Post
Old 18 June 2015, 21:18   #27
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,510
Quote:
Originally Posted by modrobert View Post
Think I get it now, after staring at your code a bit more. I confused TOD with the system time due to the abbreviation "Time Of Day", but it's actually counting HSYNC events.
That's CIA-B, IIRC. The CIA-A TOD counts 50 or 60Hz ticks. The ticks per second can be read from the TimeDevice structure TD_TODHERTZ.

Quote:
The interrupt handler updating the system time by dividing ticks is disabled while TOD keeps running, right?
Yes, I hope so. Nobody stopped the CIA-TOD.
I didn't test this code myself. It was just an idea I had when reading your solution.

Quote:
Can you explain the TV_MICRO part of the code?
After reading the 24-bit TOD (number of ticks since program start) to d0 this value has to be converted into a timval structure, i.e. split into seconds and microseconds. At the same time it is added to the timeval which we have read at program start with GetSysTime.
After the ticks have been added you can use this timeval to set your new system time (DoIO, TR_SETSYSTIME).
phx is offline  
 
Page generated in 0.04441 seconds with 11 queries