<div dir="ltr"><div dir="ltr">Sorry for the slow response.<div><br></div><div>Timedelta division is quite a nice solution to the problem. However, since we're maintaining a python version agnostic library at least until 2020, we need a solution that works in python 2 as well.</div><div><br></div><div>For the moment, we've left the code as in the original snippet.</div><div><br></div><div>Richard Belleville</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 27, 2019 at 2:56 PM Chris Barker <<a href="mailto:chris.barker@noaa.gov">chris.barker@noaa.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Did we ever hear back from the OP as to whether they were using py2 or 3?</div><div dir="ltr"><br></div><div dir="ltr">If they were unable to find timedelta division in py3 -- that's a pretty good case that we need something else.<br><div><br></div><div><br></div><div>The OP:</div><div>"""</div><div>On Wed, Feb 13, 2019 at 9:10 PM Richard Belleville via Python-Dev <<a href="mailto:python-dev@python.org" target="_blank">python-dev@python.org</a>> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>In a recent code review, the following snippet was called out as reinventing the</div><div>wheel:</div><div><br></div><div>_MICROSECONDS_PER_SECOND = 1000000</div><div><br></div><div><br></div><div>def _timedelta_to_microseconds(delta):</div><div>  return int(delta.total_seconds() * _MICROSECONDS_PER_SECOND)</div><div><br></div><div><br></div><div>The reviewer thought that there must already exist a standard library function</div><div>that fulfills this functionality. After we had both satisfied ourselves that we</div><div>hadn't simply missed something in the documentation, we decided that we had</div><div>better raise the issue with a wider audience.</div></div></div></blockquote><div>""" </div><div><br></div><div>-CHB</div><div><br></div></div>-- <br><div dir="ltr" class="gmail-m_8459154437971169625gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R            (206) 526-6959   voice<br>7600 Sand Point Way NE   (206) 526-6329   fax<br>Seattle, WA  98115       (206) 526-6317   main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div></div>
</blockquote></div></div>