Skip to content

Instantly share code, notes, and snippets.

@belden
Created April 24, 2013 15:28
Show Gist options
  • Save belden/5453005 to your computer and use it in GitHub Desktop.
Save belden/5453005 to your computer and use it in GitHub Desktop.
Testing equivalence: gmtime for cookies from an epoch
# instruct Test::Easy's time-equivalence function how to compare an epoch timestamp
# to something like "Wed, 24-Apr-2013 16:15:38 GMT"
Test::Easy::Time->add_format(
_description => 'gmtime for cookies',
format_epoch_seconds => sub {
my $gmtime = gmtime($_);
my ($day, $month, $mday, $time, $year) = split / /, $gmtime;
return sprintf '%s, %d-%s-%d %s GMT', $day, $mday, $month, $year, $time;
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment