I am working on a project in which I have to develop bio-passwords based on user's keystroke style. 
Suppose a user types a password for 20 times, his keystrokes are recorded, like 
holdtime : time for which a particular key is pressed. 
digraph time : time it takes to press a different key.
suppose a user types a password  " COMPUTER".  I need to know the time for which every key is pressed. something like :
holdtime for the above password is
C-- 200ms
O-- 130ms
M-- 150ms
P-- 175ms
U-- 320ms
T-- 230ms
E-- 120ms
R-- 300ms
The rational behind this is , every user will have a different holdtime. Say a old person is typing the password, he will take more time then a student. And it will be unique to a particular person. 
To do this project, I need to record the time for each key pressed. 
I would greatly appreciate if anyone can guide me in how to get these times. 
Editing from here..
Language is not important, but I would prefer it in C. I am more interested in getting the dataset.
The answer is conditionally "yes".
If your languages/environment has interactive keyboard support that offers Key-Down and Key-Up events, then you catch both events and time the difference between them.
This would be trivially easy in JavaScript on a web page, which would also be the easiest way to show off your work to a wider audience.
Can I get the amount of time for which a key is pressed on a keyboard