Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(54)

#23517: datetime.utcfromtimestamp rounds results incorrectly

Can't Edit
Can't Publish+Mail
Start Review
Created:
4 years, 4 months ago by tbarbugli
Modified:
4 years, 4 months ago
Reviewers:
alexander.belopolsky, tim, storchaka
CC:
tim.peters, mark.dickinson, sasha, haypo, larry, r.david.murray, alexandre.conrad_gmail.com, BreamoreBoy, vivanov_ivanov-nest.com, devnull_psf.upfronthosting.co.za, storchaka, tbarbugli_gmail.com, trcarden_surveymonkey.com
Visibility:
Public.

Patch Set 1 #

Patch Set 2 #

Patch Set 3 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Lib/datetime.py View 1 2 1 chunk +23 lines, -30 lines 2 comments Download
Lib/test/datetimetester.py View 1 2 3 chunks +20 lines, -4 lines 1 comment Download
Modules/_datetimemodule.c View 1 2 2 chunks +32 lines, -4 lines 1 comment Download

Messages

Total messages: 5
sasha
http://bugs.python.org/review/23517/diff/15518/Lib/datetime.py File Lib/datetime.py (right): http://bugs.python.org/review/23517/diff/15518/Lib/datetime.py#newcode1370 Lib/datetime.py:1370: frac, t = _math.modf(t) You may find it easier ...
4 years, 4 months ago #1
tim.peters
Stick to modf. Python's notion of modulus for floats makes good sense for integers that ...
4 years, 4 months ago #2
storchaka_gmail.com
http://bugs.python.org/review/23517/diff/15518/Lib/test/datetimetester.py File Lib/test/datetimetester.py (right): http://bugs.python.org/review/23517/diff/15518/Lib/test/datetimetester.py#newcode1864 Lib/test/datetimetester.py:1864: t = fts(9e-7) It would be interesting to test ...
4 years, 4 months ago #3
storchaka_gmail.com
http://bugs.python.org/review/23517/diff/15518/Lib/datetime.py File Lib/datetime.py (right): http://bugs.python.org/review/23517/diff/15518/Lib/datetime.py#newcode1370 Lib/datetime.py:1370: frac, t = _math.modf(t) On 2015/09/10 21:14:58, sasha wrote: ...
4 years, 4 months ago #4
tim.peters
4 years, 4 months ago #5
> May be use lrint() if available?

God no ;-)  A pile of #ifdefs won't help anything.  And what lrint() does
depends on the current FPU rounding mode in effect.  Then you have to muck with
different platform spellings fesetround() to force/restore the FPU rounding mode
too.

Do the simplest thing that could possible work.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+