Skip to content

Instantly share code, notes, and snippets.

@stevelippert
Created June 30, 2014 14:06
Show Gist options
  • Select an option

  • Save stevelippert/5ff4eef26450b010d0f3 to your computer and use it in GitHub Desktop.

Select an option

Save stevelippert/5ff4eef26450b010d0f3 to your computer and use it in GitHub Desktop.
getUTCTimestamp: A subroutine to return an epoch time stamp for UTC time.
sub getUTCTimestamp {
my ($localTime, @t, $offset);
$localTime = time;
@t = localtime(time);
$offset = timegm(@t) - timelocal(@t);
$offset =~ s/\-//g;
return ($localTime + $offset);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment