Use mktime instead of timegm (timegm is a GNU extension)
Tweak small time tests a bit