In article <mailman.5231.1389240235.18130.python-l...@python.org>, Chris Angelico <ros...@gmail.com> wrote:
> On Thu, Jan 9, 2014 at 2:35 PM, Roy Smith <r...@panix.com> wrote: > >> Yes, it *is* simple. It *is* easy. I've been working with pure-UTC > >> times (either called time_t, or TIMESTAMP WITH TIME ZONE, or even just > >> float) for decades. Like with so many other things, the easiest > >> solution is also the best, because you can just work with one stable > >> representation and abstraction on the inside, with conversions to/from > >> it at the boundaries. It IS that easy. > > > > Please show me the simple code to obtain an aware UTC datetime > > representing the current time. > > In Pike: > time(); > > In PostgreSQL: > SELECT now(); > > In C: > time(0); > > All of these give a value in UTC. None of which answer my question. How, in Python, do you get an aware UTC datetime object? I know how to get a numeric representation of the time as the number of seconds since the Unix epoch. That's not what I asked. > So maybe the key is to use utcfromtimestamp()? I don't know. So, I'm really confused what point you're trying to make. You started out arguing that I should be using aware datetimes instead of naive datetimes. I said that the reason I don't use aware datetimes is because they're so much more difficult to generate. You said they were simple to generate. 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 :-) -- https://mail.python.org/mailman/listinfo/python-list