open my $pstat, "<", "/proc/$ARGV[0]/stat" or die "$!"; chomp(my $stat_line = <$procstat>); close $pstat; my $time_offset = (split / /, $stat_line)[21]; $time_offset = int $time_offset / 100; my $btime; open my $stat, "<", "/proc/stat" or die "$!"; while (<$stat>) { if (/^btime (\d*)/) { $btime = $1; last; } } close $stat; my $start_time = $time_offset + $btime; my $length = time - $start_time; print $length;