[Twisted-Python] IReactorTime.seconds: epoch time or no?
Amber Brown (hawkowl)
hawkowl at atleastfornow.net
Mon Mar 23 14:24:21 MDT 2020
On 24/3/20 6:45 am, Richard van der Hoff wrote:
> HTTPFactory seems to think that `reactor.seconds` is reliably an epoch
> time (see
> https://github.com/twisted/twisted/blob/trunk/src/twisted/web/http.py#L3110,
> etc).
>
> On the other hand. AsyncioSelectorReactor.seconds() returns a monotonic
> time:
>
> python3 -c 'from twisted.internet import asyncioreactor;
> print(asyncioreactor.AsyncioSelectorReactor().seconds())'
> 41116.763594412
>
> One of these is wrong... I think it's HTTPFactory making bad
> assumptions, but can anyone confirm the intention here?
It's a bug in asyncioreactor. IReactorTime defines it as "current time
in seconds", which _probably_ should be defined nicer
(https://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IReactorTime.html#seconds)
but is generally epoch time.
asyncioreactor does have a few problems with time:
https://twistedmatrix.com/trac/ticket/9611
https://twistedmatrix.com/trac/ticket/9780
I can't find a bug for this issue, though, although I'm almost sure I've
seen it before... so, if you could file one (and maybe a patch to fix
it!) then that would be appreciated.
- Amber
More information about the Twisted-Python
mailing list