STINNER Victor victor.stin...@haypocalc.com added the comment:
Patch version 7:
- Drop datetime.datetime and datetime.timedelta types
- Conversion to decimal now uses a context with 1 digit to compute
exponent=1/denominator to avoid issue on t.quantize(exponent)
- Rename the format argument
STINNER Victor victor.stin...@haypocalc.com added the comment:
Patch version 6:
- timestamp format is now a type instead of a string, e.g. time.time(int)
- add int and datetime.timedelta formats, remove timespec format
- complete the documentation
- fix integer overflows, convert correctly
STINNER Victor victor.stin...@haypocalc.com added the comment:
Hum, it looks like _PyTime_AsDecimal() is wrong is ts-divisor is not a power
of 10. The exponent must be computed with Context(1), not Context(26).
Something simpler can maybe be used, I don't know even the decimal API.
--
STINNER Victor victor.stin...@haypocalc.com added the comment:
Version 5:
- add datetime and timespec formats: datetime.datetime object and (sec:
int, nsec: int)
- add timestamp optional format to os.stat(), os.lstat(), os.fstat(),
os.fstatat()
- support passing the timestamp format as a
Changes by STINNER Victor victor.stin...@haypocalc.com:
Removed file: http://bugs.python.org/file24367/time_decimal-4.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13882
___
Alexander Belopolsky alexander.belopol...@gmail.com added the comment:
On Sun, Jan 29, 2012 at 6:42 PM, STINNER Victor rep...@bugs.python.org wrote:
..
What do you call a constant argument? float and decimal?
You would prefer a constant like time.FLOAT_FORMAT?
Or maybe a boolean
STINNER Victor victor.stin...@haypocalc.com added the comment:
One possibility (still awkward IMO) would be to use the return type as
the format specifier.
Yeah, I already thaught to this idea. The API would be:
- time.time(format=float)
- time.time(format=decimal.Decimal)
-
Alexander Belopolsky alexander.belopol...@gmail.com added the comment:
On Mon, Jan 30, 2012 at 6:15 PM, STINNER Victor rep...@bugs.python.org wrote:
Another possibility is what I proposed before in the issue #11457: take a
callback argument.
http://bugs.python.org/issue11457#msg143738
I
STINNER Victor victor.stin...@haypocalc.com added the comment:
Constant arguments
What do you call a constant argument? float and decimal? You would prefer a
constant like time.FLOAT_FORMAT? Or maybe a boolean (decimal=True)?
I chose a string because my first idea was to add a registry to
STINNER Victor victor.stin...@haypocalc.com added the comment:
Patch version 4, minor update:
- remove the resolution field of _PyTime_t and remove int_log10(): use
1/divisior as the resolution to support divisor different than a power of 10
(e.g. the cpu frequency on Windows)
- inline and
Changes by STINNER Victor victor.stin...@haypocalc.com:
--
assignee: - Arfrever
Added file: http://bugs.python.org/file24367/time_decimal-4.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13882
Changes by STINNER Victor victor.stin...@haypocalc.com:
Removed file: http://bugs.python.org/file24330/time_decimal-2.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13882
___
Changes by STINNER Victor victor.stin...@haypocalc.com:
Removed file: http://bugs.python.org/file24331/time_decimal-3.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13882
___
STINNER Victor victor.stin...@haypocalc.com added the comment:
Another possible format would be tuple
Or, I forgot an obvious format: datetime!
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13882
Changes by STINNER Victor victor.stin...@haypocalc.com:
--
assignee: Arfrever -
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13882
___
___
Changes by STINNER Victor victor.stin...@haypocalc.com:
--
nosy: +skrah
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13882
___
___
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:
--
nosy: +Arfrever
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13882
___
Alexander Belopolsky alexander.belopol...@gmail.com added the comment:
Can we pick an API for this functionality that does not follow the worst of
design anti-patterns? Constant arguments, varying return type, hidden import,
and the list can go on.
What is wrong with simply creating a new
Antoine Pitrou pit...@free.fr added the comment:
Well, creating a separate module is an anti-pattern in itself. calendar vs.
time vs. datetime, anyone?
I would instead propose separate functions: decimal_time, decimal_clock... or,
if you prefer, time_decimal and so on.
--
nosy:
Alexander Belopolsky alexander.belopol...@gmail.com added the comment:
On Fri, Jan 27, 2012 at 5:17 PM, Antoine Pitrou rep...@bugs.python.org wrote:
Well, creating a separate module is an anti-pattern in itself. calendar vs.
time vs. datetime, anyone?
Are you serious? Since the invention of
Antoine Pitrou pit...@free.fr added the comment:
Are you serious? Since the invention of structural programming,
creating a separate module for distinct functionality has been one of
the most powerful design techniques.
Yes, I'm serious, and I don't see what structural programming or design
Changes by Alexander Belopolsky alexander.belopol...@gmail.com:
--
nosy: +mark.dickinson
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13882
___
Changes by Eric V. Smith e...@trueblade.com:
--
nosy: +eric.smith
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13882
___
___
Python-bugs-list
New submission from STINNER Victor victor.stin...@haypocalc.com:
Attached patch adds an optional format argument to time.time(), time.clock(),
time.wallclock(), time.clock_gettime() and time.clock_getres() to get the
timestamp as a different format. By default, the float type is still used,
STINNER Victor victor.stin...@haypocalc.com added the comment:
Some examples of the API:
$ ./python
Python 3.3.0a0 (default:52f68c95e025+, Jan 26 2012, 21:54:31)
import time
time.time()
1327611705.948446
time.time('decimal')
Decimal('1327611708.988419')
t1=time.time('decimal');
STINNER Victor victor.stin...@haypocalc.com added the comment:
Windows code (win32_clock) was wrong in time_decimal-2.patch: it is fixed in
patch version 3.
Some tests on Windows made me realize that time.time() has a resolution of 1
millisecond (10^-3) and not of a microsecond (10^-6) on
26 matches
Mail list logo