Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'represents': 0.05; 'subject:Python': 0.06; 'cc:addr:python-list': 0.11; 'jan': 0.12; 'posted': 0.15; '"to': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'recipe': 0.16; 'represents.': 0.16; 'roy': 0.16; 'time.time()': 0.16; 'timestamp': 0.16; 'utc': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'thu,': 0.19; '>>>': 0.22; 'saying': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'somewhere': 0.26; 'header:In-Reply-To:1': 0.27; 'said,': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'argue': 0.31; 'maybe': 0.34; 'subject:the': 0.34; "i'd": 0.34; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'module.': 0.36; 'so,': 0.37; 'pm,': 0.38; 'simple': 0.61; 'offer': 0.62; 'smith': 0.68; 'to:none': 0.92; 'instant': 0.97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=CIuWMgjrs/HuPRmuxrNsy11D0QC8HGccotIqYXIFiUE=; b=nT35QZ49j02c1893piYUmp96FFyDE7b7t0kt1hS7aitJ6iJW5IkYQNqGNzB6lxnb8r ETYh5YqC5tY6u8NEhxR3c+fiFbghLRTdlIsjceJsjj9CvNJRohj+6wwg45xaQY1xv070 cA0xJbycrT26gyprVm+2W0nLKDwYEBVhRUtKAWM0Vb1xXo9ivHdAeqBQuFW3j5mCRqkT naUgVjfo1cqTeVKik/6aiDFIMoOLMVC9MMZPdvmeGZz9wBPpoiGv3+ctXo8NzxQjDNY9 aRHSLHGCh8AdS/fubiSmp0Q3lZMFgT7gCMurllM49XYx2fghJ7KeT+qG5gUf6o96HXI1 5viA== MIME-Version: 1.0 X-Received: by 10.68.108.194 with SMTP id hm2mr1305767pbb.22.1389242057411; Wed, 08 Jan 2014 20:34:17 -0800 (PST) In-Reply-To: References: <78d91$52cbf8e9$541826b9$29485@cache1.tilbu1.nb.home.nl> <4b702$52cc262e$541826b9$22985@cache80.multikabel.net> <4cbf$52cc2e82$541826b9$11761@cache70.multikabel.net> <686$52cd4640$541826b9$21896@cache1.tilbu1.nb.home.nl> Date: Thu, 9 Jan 2014 15:34:17 +1100 Subject: Re: the Gravity of Python 2 From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1389242067 news.xs4all.nl 2919 [2001:888:2000:d::a6]:54641 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:63568 On Thu, Jan 9, 2014 at 3:29 PM, Roy Smith wrote: > So, I'd like to see your code which generates an aware UTC datetime > object in Python. And then we can argue about whether it's simple or > not :-) Like I said, I don't use the datetime module. But fundamentally, an aware datetime represents an instant in time - which is exactly what a POSIX timestamp ("time_t") represents. So I can't offer exact code for working with them, other than to say that time.time() is precisely accomplishing the same job. Maybe there needs to be a recipe posted somewhere saying "To create a datetime from a POSIX time, do this". This is simple: >>> time.time() 1389242048.669482 ChrisA