I have only just learned of the existence of time.perf_counter(). Apparently it only appeared in Python 3.3, so fair enough, but it seems this is now the recommended tool to use for this kind of thing, instead of time.time(). I don't imagine it would make an important difference to anything I have in mind, but I thought I would open an Issue about it, and consider whether I should switch over.
My only reservation is that the value returned is going to be different from different machines, so in cases when Timers objects are merged from different machines, the start/end times will not be comparable. The (end - start) values will still be fine, and that is all I ever use, so I don't anticipate a problem, but it would be worth noting this in the doco somehow. When I was writing the original code I had mused about the possibility of other sorts of aggregate timings based on total elapsed time, which would become impossible in this scenario, but I have never actually done this anyway.
It appears that it returns the seconds since the machine was re-booted, rather than since start of epoch, but is otherwise equivalent to time.time().
I note also that as of Python 3.7 there is a variant(time.perf_counter_ns()) which returns int nanoseconds instead of float seconds - not sure if that would be better?
Something to think about.......
I have only just learned of the existence of
time.perf_counter(). Apparently it only appeared in Python 3.3, so fair enough, but it seems this is now the recommended tool to use for this kind of thing, instead oftime.time(). I don't imagine it would make an important difference to anything I have in mind, but I thought I would open an Issue about it, and consider whether I should switch over.My only reservation is that the value returned is going to be different from different machines, so in cases when
Timersobjects are merged from different machines, the start/end times will not be comparable. The(end - start)values will still be fine, and that is all I ever use, so I don't anticipate a problem, but it would be worth noting this in the doco somehow. When I was writing the original code I had mused about the possibility of other sorts of aggregate timings based on total elapsed time, which would become impossible in this scenario, but I have never actually done this anyway.It appears that it returns the seconds since the machine was re-booted, rather than since start of epoch, but is otherwise equivalent to
time.time().I note also that as of Python 3.7 there is a variant(
time.perf_counter_ns()) which returns int nanoseconds instead of float seconds - not sure if that would be better?Something to think about.......