<div dir="ltr"><div dir="ltr">On Wed, Feb 27, 2019 at 3:04 PM Richard Belleville <<a href="mailto:rbellevi@google.com">rbellevi@google.com</a>> wrote:<br></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>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></div></blockquote><div><br></div><div>So you were limited to a py2 solution.</div><div><br></div><div>But di you poke around in py3 before posting?</div><div><br></div><div>(you should have, python-dev is really about active development, i.e. python 3 -- but that's not the point here)</div><div> </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"><div>For the moment, we've left the code as in the original snippet.</div></div></div></blockquote><div><br></div><div>If you care about microsecond precision for large timeseltas, you may want to improve that.</div><div><br></div><div>I *think* this is the "correct" way to do it:</div><div><br></div><font face="monospace, monospace">def timedelta_to_microseconds(td):</font></div><div class="gmail_quote"><font face="monospace, monospace">    return td.microseconds + td.seconds * 1000 + td.days * 86400000<br></font><br><div>(hardly tested) </div><div><br></div><div>-CHB</div><div><br></div></div>-- <br><div dir="ltr" class="gmail_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>