In Perl a function called [`timelocal`](http://perldoc.perl.org/Time/Local.html) exists to convert times to epoch.

**example:** `my $epoch = timelocal($sec, $min, $hour, $mday, $mon, $year)`

This function however appears to be inherently flawed when dealing with times very far in the past (before the year 999) - see the section on [Year Value Interpretation](http://perldoc.perl.org/Time/Local.html#Year-Value-Interpretation). To make things worse, the way it processes 2 digit years complicates things even more...

Given a time before the year 999 how can I accurately convert it to its corresponding epoch value?