You’re aren’t currently timing when the key was pressed, you are timing when the key was pressed, plus some logic plus a call to new.
Good point. Although WM_KEYDOWN / WM_KEYUP approach (commented out) has no allocations and same results. Anyway in real game I need to determine which event happend (press or release) and then determine key, so I need to do this allocations.
Especially for you reupload and fixed - pastebin
Last test up to 65 ms delays, Vsync is only 16 ms.