Look into keyboard macro programs (or whatever theyre called) and keyloggers etc. Since they log the times of recorded events (which seems to be what you want).
Eg I found this with some googling, and in the picture near middle of that page it shows some events, with duration in milliseconds (I dont know, you have to record some keypresses, then open that edit window it shows??).
But I doubt anybody is going to write you a program - you didnt even say why you need it or give any sort of detail, and writing a program takes time. At least not for free.
edit:
If you want to write it yourself, youll need to know how to program (at least basics). If you do know how, or if you dont but are willing to dedicate lots of time to learn, then do say so.
hi thank you for your help what i'm trying to do is to sync music with LED light for example i follow the beat of a song by pressing a button then i program the led with my arduino so the led will sync with the beat