Hello everybody! I'm trying to produce a timestamp (system time) in windows (Python 2.7) with resolution equal to or better than microseconds. Calling time.time() repeatedly in a loop it appears it only updates in approximately 0.01 second increments. Using datetime.datetime.today() seems to show similar results. Anybody have a possible way of getting a better timestamp?

Thanks in advance!

Edited 5 Years Ago by NewbieXcellence: n/a

It has better resolution as a timer but it doesn't give you the system time. If I could get time.clock's resolution in a timestamp I would be happy. I was considering trying to use time.clock in combination with one of the system time's to try and improve the system time resolution but not sure where to start.

Edited 5 Years Ago by NewbieXcellence: n/a

It's not a problem to display more precision in the timestamp. Both of the methods I mentioned above show high precision (datetime object has microsecond attribute), but if you call it many times in a loop you will see it only updates that value every 0.01 seconds making it a lot of useless precision. I need a high resolution timer coupled with the timestamp so I can actually compare timestamps at the microsecond level.

Edited 5 Years Ago by NewbieXcellence: n/a

It looks like calling the windows API QueryPerformanceCounter() and QueryPerformanceFrequency() functions is what I am looking for, if I can tie it in to the actual time:

http://www.grahamwideman.com/gw/tech/dataacq/wintiming.htm

I'm thinking I will try to zero my precise timer with the system time updates so I can count time with ticks.

Thanks for the responses pyTony. Any ideas would still be appreciated.

Edited 5 Years Ago by NewbieXcellence: n/a

This question has already been answered. Start a new discussion instead.