I'm confused. The code you pasted above follows the pattern for developing a linux kernel module, not an application. Are you looking to do this inside the kernel or as an application?
For the 2.6.x series, look up struct timer_list, init_timer, mod_timer, and del_timer_sync for methods to create, start, and stop a timer. You should be able to find examples online.
init_module() can print the first message and start the timer. The expiration handler prints the second message and restarts the timer. cleanup_module() should cancel the timer.