Given that this code is identical to the code man timegm reports as a portable implementation, I'm inclined to suppose you've taken it from there; if so, you should (i) give credit and (ii) check the license implications.