Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54244
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <michi.schwarz@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; '16,': 0.03; 'method.': 0.07; 'dst': 0.09; "system's": 0.09; 'python': 0.11; 'windows': 0.15; '365': 0.16; 'dst,': 0.16; 'formatted': 0.16; 'portable': 0.16; 'strftime': 0.16; 'subject:broken': 0.16; 'subject:values': 0.16; 'then?': 0.16; 'timestamp': 0.16; 'utc': 0.16; 'utc,': 0.16; 'utc.': 0.16; 'wrote:': 0.18; '(but': 0.19; 'thanks.': 0.20; 'to:name:python-list@python.org': 0.22; 'print': 0.22; 'example.': 0.24; 'mon,': 0.24; '+0200': 0.26; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'michael': 0.29; 'rest': 0.29; '+0100,': 0.31; 'sep': 0.31; 'class': 0.32; '(e.g.': 0.33; 'convert': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'date.': 0.36; 'in.': 0.36; 'shows': 0.36; 'should': 0.36; 'message-id:@gmail.com': 0.38; 'needed': 0.38; 'to:addr:python-list': 0.38; 'that,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'according': 0.40; 'field.': 0.61; 'introduced': 0.61; 'header:Message-Id:1': 0.63; 'information': 0.63; 'charset:windows-1252': 0.65; 'here': 0.66; 'saw': 0.77; '2013,': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:message-id:mime-version:subject:date:references :to:in-reply-to; bh=YZ+BLTf4YTfz4rSYmtf4piaoF0slUP516IVpi18BgxU=; b=lS/eF/KTqzRBM3/Du13scDvxtlf0vZZcGDUSUPi6JI0BD4w+LWyxDTTUgLE1MsDCSK A9+6sBgsNRbqhUDdHSBqSxsjd8sFBzIG8RYY6Kjig4R3eQCNJgVZyU4EYkOUmigdUG/p mbLXPtxGnHvouzj2PMqPv9xnk01kMMHRYpOl3CgnZAxLyTAJJF6YWjcOSpLcUPmzBI0I uBBunBWCh6rA87e6Bi1sq/rhgVU0auLgvHbh+3AjeLIZ4hxVEPCFQelJw1setqCA474J Rps2HQhHspPIKvLZUVLfgL15H50sJwXqj+VI9DlNFhPfiMsxgbb4eWXK0ehF2u7f6W7K D3nw== |
| X-Received | by 10.14.225.199 with SMTP id z47mr46227030eep.24.1379364936043; Mon, 16 Sep 2013 13:55:36 -0700 (PDT) |
| From | Michael Schwarz <michi.schwarz@gmail.com> |
| Content-Type | multipart/signed; boundary="Apple-Mail=_0DB3B031-F49C-46F9-A58E-756F59073300"; protocol="application/pkcs7-signature"; micalg=sha1 |
| Mime-Version | 1.0 (Mac OS X Mail 6.5 \(1508\)) |
| Subject | Re: Is %z broken for return values of time.gmtime()? |
| Date | Mon, 16 Sep 2013 22:55:33 +0200 |
| References | <3C2755B3-2478-45E1-88F5-9FD961F2B1BD@gmail.com> <1379354161.1707.22675889.2647208B@webmail.messagingengine.com> |
| To | "python-list@python.org" <python-list@python.org> |
| In-Reply-To | <1379354161.1707.22675889.2647208B@webmail.messagingengine.com> |
| X-Mailer | Apple Mail (2.1508) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.36.1379364943.18130.python-list@python.org> (permalink) |
| Lines | 96 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1379364943 news.xs4all.nl 15915 [2001:888:2000:d::a6]:52328 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:54244 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On 2013-W38-1, at 19:56, random832@fastmail.us wrote: > On Mon, Sep 16, 2013, at 9:15, Michael Schwarz wrote: >> According to the documentation of time.gmtime(), it returns a struct_time >> in UTC, but %z is replaced by +0100, which is the UTC offset of my OS’s >> time zone without DST, but DST is currently in effect here (but was not >> at the timestamp passed to gmtime()). > > The struct_time type does not include information about what timezone it > is in. Uhm … Python 3.3 introduced the tm_gmtoff member of struct_time, which contains the offset to UTC. I thought, %z was also introduced in Python 3.3 and so I thought it would use that field. What time zone does it use then? Does it always use the system's time zone? > You can use datetime.datetime (e.g. datetime.datetime.fromtimestamp(40 * > 365 * 86400,datetime.timezone.utc) - the datetime.datetime class has a > strftime method. I do use that, but I was using time.localtime() to convert a POSIX timestamp to a date using the system's timezone and saw that while a struct_time produced by time.localtime() and formatted using time.strftime() shows the correct time zone (+0100 and +0200 here), it does not for a struct_time produced by time.gmtime(). I think that's strange. > You should be aware that %F and %T are not portable and won't work on > windows for example. I’m aware of that, but thanks. I was toying around and just needed to print the rest of the date. Regards Michael
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Is %z broken for return values of time.gmtime()? Michael Schwarz <michi.schwarz@gmail.com> - 2013-09-16 22:55 +0200
csiph-web