Perlfunc: get_uptime()

Simple code to get the current uptime in days.

sub get_uptime { open(FILE,'/proc/uptime'); my $line = ; close FILE; # The first value is seconds of uptime, not sure about the second my ($seconds,$foo) = split(/\s+/,$line); # Convert seconds to days my $ret = int($seconds / (3600 * 24)); return $ret; }

Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
Logged IP:
To prevent spam please submit by clicking the kitten: