[Datetime-SIG] Datetime - my issues

Guido van Rossum guido at python.org
Thu Jul 30 11:13:22 CEST 2015


On Thu, Jul 30, 2015 at 5:33 AM, Tim Peters <tim.peters at gmail.com> wrote:

> [...]
>
> You're using methods designed for interoperability with the C
> language's ubiquitous "struct tm":
>
>     http://pubs.opengroup.org/onlinepubs/007908775/xsh/time.h.html
>
> The meanings, and even the names of the fields, are identical between
> Python and C.


Actually the meanings of some fields are different -- C's tm_mon is 0-11,
while Python's is 1-12; also, C's tm_year is "year - 1900" while Python's
is the full 4-digit year (IIRC we had to change the latter in order to ward
off Y2K issues).


> A struct tm doesn't know microseconds from doughnuts.
> That's why microseconds are missing here.


But we could still add it. By now the similarity to C for various APIs is
just there to help C programmers quickly get their bearings in Python, not
a hard philosophical line in the sand.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20150730/dd4ff263/attachment.html>


More information about the Datetime-SIG mailing list