Menu

#1665 documentation error - gnuplot epoch is 2000 not 1970

None
closed-out-of-date
nobody
None
2015-08-21
2015-08-19
dooglus
No

Version 4.6 patchlevel 6

gnuplot> help set timefmt tells me:

The valid formats are:
%s seconds since the Unix epoch (1970-01-01, 00:00 UTC)

but it appears to actually be interpreting the data as seconds since 2000, not since 1970.

Either the documentation or the code needs to change, since they currently disagree with each other.

Discussion

  • Ethan Merritt

    Ethan Merritt - 2015-08-19

    The epoch used by gnuplot prior to version 5 was 2000-01-01.
    In version 5 it changed to conform to the unix standard 1970-01-01.

    The version 5 documentation is correct for version 5.
    The version 4 document was correct for most of version 4, but as you correctly point out the files included with the 4.6.6 incremental update are wrong.

    I do not know how those lines of the documentation file in the 4.6.6 release package came to incorrectly describe the version 5 behavior rather than the version 4 behavior. That change is not showing in the cvs revision history for version 4, so something strange must have happened. I can fix it in the archived 4.6 cvs repository, but since no further release is planned for 4.6 it may be that noone ever sees it.

    Good catch, but I'm afraid without a time machine there's no fix for the mismatch.

     
  • Ethan Merritt

    Ethan Merritt - 2015-08-19
    • Group: -->
    • Priority: -->
     
    • Ethan Merritt

      Ethan Merritt - 2015-08-19

      I have to back off from that explanation. The documentation has always had 1970 in the place you mention. Whether it was correct or not I would have to go back and investigate in archived versions of the program. I stand by the statement that both the documentation and program for version 5 use 1970 as the epoch date.

       
  • Hans-Bernhard Broeker

    That particular line of the documentation has said "1970" ever since I documented this in 2002, and IIRC it has been correct all the time. This timefmt was invented specifically because gnuplot's internal epoch is not the same as that of Unix. Otherwise we could just have passed through ordinarirly parsed numbers into the core and treated them as timestamps.

    it appears to actually be interpreting the data as seconds since 2000, not since 1970.

    Does it? It does not look like that, here:

    gnuplot> set xdata time
    gnuplot> set timefmt '%s'
    gnuplot> set format x '%Y-%m-%d'
    gnuplot> set table
    gnuplot> p '-' u 1:2 w p
    input data ('e' ends) > 0 1970
    input data ('e' ends) > 31415265 1971
    input data ('e' ends) > e
    Curve 0 of 1, 2 points
    Curve title: "'-' u 1:2"
    x y type
    "1970-01-01" 1970 i
    "1970-12-30" 1971 i

    The output is the same from 4.4-pl0 all the way to HEAD.

     
  • Ethan Merritt

    Ethan Merritt - 2015-08-21
    • status: open --> closed-out-of-date
     

Log in to post a comment.

MongoDB Logo MongoDB