homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients belopolsky, cmcqueen1975, docs@python, dwsarber, ezio.melotti, lemburg, maksbotan, pitrou, python-dev, r.david.murray
Date 2013年01月16日.21:52:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1358373180.02.0.525948062265.issue12758@psf.upfronthosting.co.za>
In-reply-to
Content
> It makes a difference. It seems with the current behaviour, the
> "epoch" is _in the local timezone_.
No it isn't. Two different machines:
$ LANG=C date
Wed Jan 16 21:47:03 UTC 2013
$ python -c "import time; print(time.time())"
1358372827.5
$ LANG=C date
Wed Jan 16 22:47:21 CET 2013
$ python -c "import time; print(time.time())"
1358372848.2
time.time() *is* timezone-independent.
Now to your question:
> However, what I'd really prefer is a new function that returns the
> seconds since the epoch in UTC.
>>> epoch = datetime(1970, 1, 1)
>>> (datetime.utcnow() - epoch).total_seconds()
1358372978.448235
>>> time.time()
1358372980.176238
History
Date User Action Args
2013年01月16日 21:53:00pitrousetrecipients: + pitrou, lemburg, belopolsky, ezio.melotti, r.david.murray, cmcqueen1975, docs@python, python-dev, maksbotan, dwsarber
2013年01月16日 21:53:00pitrousetmessageid: <1358373180.02.0.525948062265.issue12758@psf.upfronthosting.co.za>
2013年01月16日 21:53:00pitroulinkissue12758 messages
2013年01月16日 21:52:59pitroucreate

AltStyle によって変換されたページ (->オリジナル) /