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 akira
Recipients akira, belopolsky, cvrebert, docs@python
Date 2014-12-02.08:02:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <> (Alexander Belopolsky's message of "Tue, 02 Dec 2014 00:38:57 +0000")
> Alexander Belopolsky added the comment:
>> I've provide the direct quote from *C* standard ...
> I understand that C standard uses the word "encoding", but it does so
> for a reason that is completely unrelated to the choice of epoch.
> "Encoding" is how the bytes in memory should be interpreted as "number
> of seconds" or some other notion of time.  For, example "two's
> complement little-endian 32-bit signed int" is an example of valid
> time_t encoding, another example would be IEEE 754 big-endian 64-bit
> double.  Note that these choices are valid for both C and POSIX
> standards.

I agree one *part* of "encoding" is how time_t is *represented* in
memory but it is not the only part e.g.:

  The mktime function converts the broken-down time, expressed as local
  time, in the structure pointed to by timeptr into a calendar time
  value with the same encoding as that of the values returned by the
  time function.

notice: "the same encoding as ... returned by the time function".

time() function can return values with different epoch (implementation
defined). mktime() is specified to use the *same* encoding i.e., the
same epoch, etc.

i.e., [in simple words] we have calendar time (Gregorian date, time) and
we can convert it to a number (e.g., Python integer), we can call that
number "seconds" and we can represent that number as some (unspecified)
bit-pattern in C.

I consider the whole process of converting "time" to a bit-pattern in
memory as "encoding" i.e., "32/64, un/signed int/754 double" is just
*part* of it e.g.,

1. specify that 1970-01-01T00:00:00Z is zero (0)
2. specify 0 has time_t type
3. specify how time_t type is represented in memory.

I may be wrong that C standard includes the first item in time

> If you google for your phrase "time in POSIX encoding", this issue is
> the only hit.  This strongly suggests that your choice of words is not
> the most natural.

I've googled the phrase (no surrounding quotes) and the links talk about
time encoded as POSIX time [1] and some *literally* contain the phrase
*POSIX encoding* [2] because *Python* documentation for calendar.timegm
contains it [3]:

  [timegm] returns the corresponding Unix timestamp value, assuming an
  epoch of 1970, and the POSIX encoding. In fact, time.gmtime() and
  timegm() are each others’ inverse.

In an effort to avoid personal influence, I've repeated the expreriment
using Tor browser and other search engines -- the result is the same.

timegm() documentation might be the reason why I've used the phrase.

I agree "POSIX encoding" might be unclear. The patch could be replaced
by any phrase that expresses that some functions in stdlib assume that
time.time() returns (+/- fractional part) "seconds since the Epoch" as
defined by POSIX [4].

Date User Action Args
2014-12-02 08:02:14akirasetrecipients: + akira, belopolsky, cvrebert, docs@python
2014-12-02 08:02:14akiralinkissue22356 messages
2014-12-02 08:02:13akiracreate