PHP 43 40 bytes:
I hope this is an acceptable answer:
set_time_limit($_REQUEST['t']);while(!0);
<?for(set_time_limit($_REQUEST['t']);;);
I could do like this: <?for(set_time_limit($_POST['t']);;);
but it would lose flexibility and 3 bytes.
And i could cheat and do like this: <?for(set_time_limit($_REQUEST[t]);;);
. It shaves off 2 bytes, but it's not a "standard" solution. Lets keep the game fair.
As @fireeyedboy and @primo suggested, you can also use this solution (34 bytes):
<?for(set_time_limit($argv[1]);;);
This allows it's use from the console, calling it like this:
php <filename> <time in seconds>
php <filename> <time in seconds>
As i told, I'm not targeting the console solution, but they have to get the credit for this one.
Another answer could be this "monster", which is just both answers combined:
<?for(set_time_limit($argv[1]|$_REQUEST['t']);;);
It's impossible to get key presses in php, without being on console, which I'm not targeting!
To stop it, you MUST abort the process (stopping the page from loading might stop the code)!
As a plus, it works in Android too! If you install a php server (free on Google Play).
To make it work, simply do like this:
You create a .php webpage and append ?t=<time in seconds>
to the end of the url or submit a post (using a form or even ajax).