I'm using the standard
I guess I should have done a bit more searching before asking. It turns out there's a little known
timegm function which does the opposite of
gmtime. It's supported on GNU and BSD which is good enough for my purposes. A more portable solution is to temporarily set the value of the
TZ environment variable to "UTC" and then use
mktime, then set
timegm works for me.