enthought / traits

Observable typed attributes for Python classes
Other
421 stars 85 forks source link

Fix use of the deprecated datetime.utcnow method #1758

Closed mdickinson closed 10 months ago

mdickinson commented 10 months ago

This PR replaces uses of the deprecated (as of Python 3.12) datetime.utcnow method. Note that this isn't quite a like-for-like change: there's a slight difference in the output format. Given that the event tracer is barely used in practice, I doubt this change matters much.

>>> from datetime import datetime, timezone
>>> datetime.now(timezone.utc).isoformat(" ")
'2023-09-11 16:31:35.534330+00:00'
>>> datetime.utcnow().isoformat(" ")
'2023-09-11 16:31:56.798474'