CmpTimes.pl

From Organic Design wiki
# For some reason there's no strtotime() equivalent in PERL's default install
# - this is a temp solution working for hh:mm.+d|dd.+mmm|mmmm.+yy|yyyy format{{perl}}
sub cmpTimes {
	my @times = @_;
	my $i = 0;
	for (@times) {
		for my $m ('jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec') {
			s/$m\w*/$i%12+101/ie;
			$i++;
			}
		s/^\D*(\d\d):(\d\d)\D+(\d+)\D+(\d\d\d)\D+(\d\d)\D*$/20$5$4$3$1$2/g;
		s/^\D*(\d\d):(\d\d)\D+(\d+)\D+(\d\d\d)\D+(\d\d\d\d)\D*$/$5$4$3$1$2/g;
		}
	return $times[1] > $times[0] ? -1 : $times[0] > $times[1];
	}