Time Limitation

I want my opengl program to run only within a certain time limit…only for a couple of seconds. Whatever the user can do is limited within this time.
How do i achieve this ?

That does not depend on OpenGL but on your operating system. You could start some timer and when it expires do whatever you planned to do.

Thanks!