System-Startup. SetClock, and calculating system uptime

Online Status

I'd like to be able to calculate system uptime, for example using GetSysTime, but my RTC is getting in the way.

From what I understand, there is no system clock that is not overwritten by the RTC sometime soon after power on.

I'm trying to figure out when the system checks for an RTC on boot. The current documentation for System-Startup doesn't mention when this might happen. On older versions of AmigaOS, this happened when SetClock was run in Startup-Sequence, but nowadays, SetClock no longer appears here -- and the system time is updated from the RTC module anyway.

Anyone who can tell me when RTC time is copied over to system time at startup? Or, ideally, if there's a built-in way to calculate system uptime already included in the kernel?

Online Status

As I understand it the E clock is uptime. The system time you can get with GetSysTime is however as you assume a corrected time. But the correction is done when you request it. Then the offset is added to the hardware c(E) lock. As for when this is setup is when the timer device intializes. So pretty early during system boot

You can get the E clock with ReadEClock() from timer device

Online Status

Thanks! ReadEClock seems to give me the system uptime, as you suggest. The documentation is still a bit vague about what EClock is and is for, so that's why I didn't look into it first.

I also noticed that the source code for Scout uses the creation date of RAM: as a useful surrogate for system startup time.

By the way, what relation, if any, is there between the EClock and the CIA clock registers?

Online Status

By the way, what relation, if any, is there between the EClock and the CIA clock registers?

CIA timers are driven by EClock.