On Wed, Feb 27, 2019 at 3:04 PM Richard Belleville <rbell...@google.com> wrote:
> 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. > So you were limited to a py2 solution. But di you poke around in py3 before posting? (you should have, python-dev is really about active development, i.e. python 3 -- but that's not the point here) > For the moment, we've left the code as in the original snippet. > If you care about microsecond precision for large timeseltas, you may want to improve that. I *think* this is the "correct" way to do it: def timedelta_to_microseconds(td): return td.microseconds + td.seconds * 1000 + td.days * 86400000 (hardly tested) -CHB -- Christopher Barker, Ph.D. Oceanographer 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.bar...@noaa.gov
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com