# Getting the time of actual screen refresh

**URL:** <https://forum.opencv.org/t/getting-the-time-of-actual-screen-refresh/5024>\
**Category:** Python\
**Tags:** highgui\
**Created:** [September 1, 2021, 9:33pm UTC](https://forum.opencv.org/t/getting-the-time-of-actual-screen-refresh/5024 "2021-09-01T21:33:26Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Constantino\_Dragicev](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/constantino_dragicev/32/3074_2.png) [@Constantino\_Dragicev](https://forum.opencv.org/u/Constantino_Dragicev)\
**Post date:** [September 6, 2021, 7:45pm UTC](https://forum.opencv.org/t/getting-the-time-of-actual-screen-refresh/5024/3 "2021-09-06T19:45:09Z")

</div>

Thanks for you answer. I need two things to precisely synchronize data files from two different computers. First, analyze data already recorded in a “bad way”, and then, improve my code before re-executing my experiments to record better data.

For the first step, I need the time difference between the moment of code execution and actual screen refresh, because I already recorded data that way. In computer 1, a given line of code wrote to file a timestamp with absolute time, and the next line is cv2.waitKey(500) function. Later in time, the screen displays the image, while computer 2 detects the luminance change with a small photodiode (in the corner of the screen). So, in fact, I have to different delays. Delay 1 is the difference between 2 consecutive lines of code (unknown, but estimated in the 1-10 milisecond range). Delay 2 is the difference between the call to waitKey and the physical response of the monitor.  
So, the point is that I have the photodiode signal in one computer, while controlled the screen and recorded timestamps with another. Specifically, I need to know when the timestamp of computer 1 matches in time with photodiode signal in computer 2.

I don’t need to display at a specific, constant rate, but I do need to know as precise as possible when the instruction for screen change was given, relative to the real response of the screen.

For step 2 I have no clue despite your advices, because there can always be a delay between a display function and the next frame of the screen.

---

_[View the full topic](https://forum.opencv.org/t/getting-the-time-of-actual-screen-refresh/5024)._
