On Linux (including OnlineGDB) you can use sleep() to make the given thread sleep for a given number of seconds.
Is this what you're after?