[Twisted-Python] IReactorTime.seconds: epoch time or no?
Richard van der Hoff
richard at matrix.org
Fri Mar 27 08:24:23 MDT 2020
On 26/03/2020 09:23, Barry Scott wrote:
> Why does Twisted need to duplicate the built in python time features? > What was wrong with using time.time() for the access logs?
I feel like glyph's already answered this: use of `time` makes for poor
testability. You might argue you don't care for access logs, since we
aren't going to check the exact output, but (a) we probably *should*
check the output matches the given timestamp, and (b) if a pattern's
worth following, it's worth following everywhere.
> Surely reactors must be use monotonic time to avoid breaking protocol
> timing across wall-clock time being adjusted by ntp etc.
Again, I think glyph's answered this. There *should* be a method for
getting a monotonic-time, and things that do scheduling should use it;
but that method shouldn't be `seconds()`.
Thanks to Amber and glyph for answering my original question: I've
opened https://twistedmatrix.com/trac/ticket/9787 to track the issue.
More information about the Twisted-Python
mailing list