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.
If you read from the terminal in conical mode, you can read each keystroke as it's pressed. You won't see keydown keyup events, like you could if you trapped X events, but it's probably easier, especially if you're just running in a console or terminal.
Can I get the amount of time for which a key is pressed on a keyboard