Search code examples
pythontimestamppyhook

Why, using pyHook, the timestamp (event.Time) of the events is wrong?


This is the code that I used to debug the events:

print("Real timestamp:", int(time()))
print("Event Timestamp:", event.Time)
print("Event Time:", strftime("%H:%M:%S %z", localtime(event.Time)))

And this is the output I got:

Real timestamp: 1472741855
Event Timestamp: 50129625
Event Time: 06:53:45 W. Europe Daylight Time

Does someone know why this happens or which time is returning? Thanks.


Solution

  • The time returned is not the actual Timestamp

    The time returned comes straight from the "time" member of the Win32 EVENTMSG struct, which is in units of "milliseconds since last boot".

    Shameless plugin from here