+sub convert_time {
+ my $in = shift;
+ my ($ticks, $unit) = ($in =~ /^(\d+)([smhdw]?)$/);
+
+ if ($unit eq 's' || $unit eq '') { }
+ elsif ($unit eq 'm') { $ticks *= 60; }
+ elsif ($unit eq 'h') { $ticks *= 60*60; }
+ elsif ($unit eq 'd') { $ticks *= 60*60*24; }
+ elsif ($unit eq 'w') { $ticks *= 60*60*24*7; }
+ else { die "Invalid unit '$unit' in '$in'\n" }
+ return $ticks;
+}
+