Somebody did write a timer library that enabled you to have a function called after a delay, or at regular intervals. The code needed to implement that behaviour directly is pretty simple and not substantially more complex than the code needed to do the equivalent behaviour using the library, but the library is there if you want to use it.