Fixed-point Duration with Clock::SCALING_FACTOR
Piroro-hs opened this issue · comments
Piroro-hs commented
It's convenient to have fixed-point Duration
s whose time unit is same as Clock
's.
It could be useful for use-case like below.
// assume clock rate is multiple of 3
// this periodic timer runs at exactly 3Hz
let timer = clock.new_timer(3_u32.Hz().to_duration::<ClockDuration<Clock>>().unwrap()).into_periodic();
// while this is not
let timer = clock.new_timer(3_u32.Hz().to_duration::<Milliseconds>().unwrap()).into_periodic();
Peter Taylor commented
First, thank you for the suggestion. Second, I'm very sorry for the delay. I do see the value of this. It would, however, need to be a Generic duration which is less efficient, but if needs must.
I will definitely look into this.