[Python-Dev] datetime.timedelta total_microseconds
chris.barker at noaa.gov
Wed Feb 27 17:56:06 EST 2019
Did we ever hear back from the OP as to whether they were using py2 or 3?
If they were unable to find timedelta division in py3 -- that's a pretty
good case that we need something else.
On Wed, Feb 13, 2019 at 9:10 PM Richard Belleville via Python-Dev <
python-dev at python.org> wrote:
> In a recent code review, the following snippet was called out as
> reinventing the
> _MICROSECONDS_PER_SECOND = 1000000
> def _timedelta_to_microseconds(delta):
> return int(delta.total_seconds() * _MICROSECONDS_PER_SECOND)
> The reviewer thought that there must already exist a standard library
> that fulfills this functionality. After we had both satisfied ourselves
> that we
> hadn't simply missed something in the documentation, we decided that we had
> better raise the issue with a wider audience.
Christopher Barker, Ph.D.
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev