#!/usr/bin/perl -sw use strict; use Benchmark; use Time::Local; our $ITERATIONS ||= 1e7; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime(time); timethese($ITERATIONS, { timegm => sub { my $time = timegm($sec,$min,$hour,$mday,$mon,$year); }, timelocal => sub { my $time = timelocal($sec,$min,$hour,$mday,$mon,$year); }, } ); __END__ $ perl 619744.pl Benchmark: timing 10000000 iterations of timegm, timelocal... timegm: 95 wallclock secs (89.95 usr + 0.06 sys = 90.01 CPU) @ 111098.77/s (n=10000000) timelocal: 811 wallclock secs (654.30 usr + 112.15 sys = 766.45 CPU) @ 13047.17/s (n=10000000)