feat: Duration Support#105
Conversation
Added support for the core duration type for abs_diff_eq as mentioned in
|
Hi and thanks for the PR. I have a few suggestions/questions:
|
|
A quick look at https://en.wikipedia.org/wiki/High_Precision_Event_Timer notes that HPET devices run at at least 10 MHz giving a time resolution of roughly 100ns. Most modern devices run between 14MHz and 25MHz which gives roughly 70ns to 40ns resolution. The wikipedia article also states that reading requires about 1-2µs of time as well. However I would suspect that this reading delay will only affect absolute times, not time deltas, as long as it is concistent across measurement operations. |
|
Thanks for the feedback. I copied the epsilon as I was comparing it to integers which is the internal representation. i.e. we don't expect any error from purely mathematical operations as with floating point. However I'm happy to set it higher if it makes more sense but I confess I'm not entirely following the logic of the timer. I believe you are saying that if we say the underlying resolution is 100ns then that should be the epsilon as anything lower is essentially the same point in time from a computers perspective? |
Yes. As far as I have understood the hardware and software interplay, there is a ~100ns resolution for HPET timers. It could still be debated if it might make sense to use this as an epsilon in an approximate comparison. Maybe it is best if we ask in the rust forum for help. What do you think? |
|
I asked in the forum: Let's see what people say about that. |
|
Great thanks - apologies for the slow response! |
|
I think I am going to merge this with the default |
Added support for the core duration type for abs_diff_eq as mentioned in #103
Default is to treat it similar to an unsigned value with 0 epsilon but included tests allowing greater epsilon values.