[Python-Dev] Store timestamps as decimal.Decimal objects
Alexander Belopolsky
alexander.belopolsky at gmail.com
Tue Jan 31 19:57:49 CET 2012
On Mon, Jan 30, 2012 at 6:31 PM, Victor Stinner
<victor.stinner at haypocalc.com> wrote:
> Alexander Belopolsky proposed to use
> time.time(format=datetime.datetime) instead.
Just to make sure my view is fully expressed: I am against adding flag
arguments to time.time(). My preferred solution to exposing high
resolution clocks is to do it in a separate module. You can even call
the new function time() and access it as hirestime.time(). Longer
names that reflect various time representation are also an option:
hirestime.decimal_time(), hirestime.datetime_time() etc.
The suggestion to use the actual type as a flag was motivated by the
desire to require module import before fancy time.time() can be
called. When you care about nanoseconds in your time stamps you won't
tolerate an I/O delay between calling time() and getting the result.
A separate module can solve this issue much better: simply import
decimal or datetime or both at the top of the module.
More information about the Python-Dev
mailing list