Author vstinner
Recipients Alexander.Belopolsky, Arfrever, belopolsky, eric.smith, loewis, mark.dickinson, pitrou, skrah, vstinner
Date 2012-02-13.00:23:11
SpamBayes Score 2.22711e-13
Marked as misclassified No
Message-id <1329092593.14.0.668972137934.issue13882@psf.upfronthosting.co.za>
In-reply-to
Content
Here is the version 17 of my patch. This version is mostly complete and so can be reviewed. Summary of the patch:

 - Add a _PyTime_t structure to store any timestamp in any resolution, universal structure used by all functions manipulating timestamps instead of C double to avoid loss of precision
 - Add many functions to create timestamp (set _PyTime_t structure) or to get a timestamp in a specific format (int, float, Decimal, timeval or timespec structure, in milliseconds, etc.)
 - Round to nearest with ties going away from zero (rounding method called "ROUND_HALF_UP" in Decimal)
 - Functions creating timestamps get a new optional timestamp argument to specify the requested return type, e.g. time.time(timestamp=int) returns an int
 - Functions getting timestamps argument now also support decimal.Decimal
 - Raise an OverflowError instead of a ValueError if a timestamp cannot be stored in a C time_t type

The patch is huge, but as I wrote before, I will split it into smaller parts:

 - Add _PyTime_t API
 - Use the new API in the time module
 - Use the new API in the os module
 - etc.

Changes in the version 17 of my patch:

 - tested on Linux 32/64 bits, OpenBSD 64 bits, FreeBSD 64 bits, Windows 64 bits
 - fix portability issues (for various time_t and C long sizes)
History
Date User Action Args
2012-02-13 00:23:19vstinnersetrecipients: + vstinner, loewis, mark.dickinson, belopolsky, pitrou, eric.smith, Arfrever, skrah, Alexander.Belopolsky
2012-02-13 00:23:13vstinnersetmessageid: <1329092593.14.0.668972137934.issue13882@psf.upfronthosting.co.za>
2012-02-13 00:23:12vstinnerlinkissue13882 messages
2012-02-13 00:23:12vstinnercreate