Converting times before the year 999 to epoch

Viewed 288

In Perl a function called timelocal 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. 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?

3 Answers
Related