[pypy-issue] [issue986] Problems with timezones in datetime.datetime

Dan Villiom Podlaski Christiansen tracker at bugs.pypy.org
Sat Jan 7 19:48:46 CET 2012


New submission from Dan Villiom Podlaski Christiansen <danchr at gmail.com>:

Try running the following little script:

=========
import datetime, os, time

os.putenv('TZ', 'GMT')

def bug():
  ct = time.time()
  delta = (datetime.datetime.utcfromtimestamp(ct) -
           datetime.datetime.fromtimestamp(ct))

  return delta.days * 86400 + delta.seconds

print ' '.join(str(bug()) for x in xrange(10))
===========

Under CPython I get:

===========
0 0 0 0 0 0 0 0 0 0
===========

Under PyPy 1.7 as well as the latest nightly I get something like:

===========
0 -1 0 -1 0 0 0 0 -1 0
===========

This is somewhat unexpected.

----------
messages: 3653
nosy: danchr, pypy-issue
priority: bug
release: 1.7
status: unread
title: Problems with timezones in datetime.datetime

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue986>
________________________________________


More information about the pypy-issue mailing list