mirror of
https://github.com/justinian/jsix.git
synced 2025-12-11 08:54:31 -08:00
[kernel] Fix clock period vs frequency error
Calling `spinwait()` was hanging due to improper computation of the clock rate because justin did a dumb at math. Also the period can be greater than 1ns, so the clock's units were updated to microseconds.
This commit is contained in:
@@ -20,12 +20,8 @@ public:
|
||||
/// Configure the timer and start it running.
|
||||
void enable();
|
||||
|
||||
/// Wait in a tight loop while reading the HPET counter.
|
||||
/// \arg ns Number of nanoseconds to wait
|
||||
void spinwait(uint64_t ns) const;
|
||||
|
||||
/// Get the timer rate in ticks per ns
|
||||
inline uint64_t rate() const { return m_period * 1000000ull; }
|
||||
/// Get the timer rate in ticks per us
|
||||
inline uint64_t rate() const { return 1000000000/m_period; }
|
||||
|
||||
/// Get the current timer value
|
||||
uint64_t value() const;
|
||||
|
||||
Reference in New Issue
Block a user