The catch is that datetime.isoformat() is not *exactly* the same as '%Y-%m-%dT%H:%M:%S.%f' (when microseconds is 0), but in practice it's probably fine since they are pretty much always timeutils.utcnow() with microseconds. To err on the side of caution though, I intentionally did not change 5 instances of timeutils.strtime in the production path code (vs the unit tests) to be revisited later.
That said, I like a combination of both of our approaches: isoformat when it's safe, and an explicit '%Y-%m-%dT%H:%M:%S.%f' in the production code path when there's some doubt about remaining backwards compatible. I'll update my patch to combine both approaches and add you as an additional author.
I also worked on removing these warnings, but I took a slightly different approach.
https:/ /review. openstack. org/#/c/ 240411
You were explicit, and included the format in all cases:
BEFORE: timeutils. strtime( timeutils. utcnow( )) utcnow( ).strftime( '%Y-%m- %dT%H:% M:%S.%f' )
AFTER: timeutils.
Where as my goal was to move toward the simpler .isoformat() where possible:
BEFORE: timeutils. strtime( timeutils. utcnow( )) utcnow( ).isoformat( )
AFTER: timeutils.
The catch is that datetime. isoformat( ) is not *exactly* the same as '%Y-%m- %dT%H:% M:%S.%f' (when microseconds is 0), but in practice it's probably fine since they are pretty much always timeutils.utcnow() with microseconds. To err on the side of caution though, I intentionally did not change 5 instances of timeutils.strtime in the production path code (vs the unit tests) to be revisited later.
https:/ /docs.python. org/2/library/ datetime. html#datetime. datetime. isoformat
That said, I like a combination of both of our approaches: isoformat when it's safe, and an explicit '%Y-%m- %dT%H:% M:%S.%f' in the production code path when there's some doubt about remaining backwards compatible. I'll update my patch to combine both approaches and add you as an additional author.