Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

How do timestamps work (on legacy backend)?

Hey guys,

can anybody help me wrap my head around the timestamps which are produced using the legacy backend?

Below are timestamps from the first three pages in my experiment:

time_p1 2785413
time_p2 2795971
time_p3 2816138

Does anybody know what the unit of measurement is for these?

What the manual has to say: "The absolute meaning of the timestamp (i.e. when it was 0) depends on the backend." I'm really not sure what that is supposed to mean :smiley:

What I actually need are the differences between the timestamps, e.g. x = time_p2 - time_p1.
Now, this is actually kinda working. In the example above I spend 10 seconds on the first page and 20 seconds on the second page. If I calculate differences I get pretty close:

time_p2 - time_p1 = 10558
time_p3 - time_p2 = 20167

This would indicate that the timestamps are actually in milliseconds. Which would make sense, but how are my starting value so large if that's the case? Am I missing something ridiculously obvious here?

Thanks in advance

Fwiw: I tried using the other backends, but every backend except for legacy crashes on my system... so I'm kind of stuck with legacy for now.



  • HI Steffen,

    The units of the timestamps are always in milliseconds. The 0 point has no real meaning, in the sense that different backends may use different 0 points. In the case of the legacy backend, I believe that the 0 point is the moment at which pygame was first initialized, so that might correspond to the time that you ran the experiment for the first time.

    But the 0 point is generally irrelevant, because, as you say, you generally want to know the difference between two timestamps.

    Does that clear things up?


    There's much bigger issues in the world, I know. But I first have to take care of the world I know.

Sign In or Register to comment.