WIP: add a compat implementation of timegm

This needs to be split into two commits, one introducing the compat
infrastructure and one adding the compat timegm.

Signed-off-by: John Keeping <john@keeping.me.uk>