public function getUpTime()
    {

        // Time?
        if (!empty($this->settings['timer'])) {
            $t = new Timer('Uptime');
        }

        // Get contents
        $contents = Common::getContents('/proc/uptime', false);

        // eh?
        if ($contents === false) {
            Errors::add('Linfo Core', '/proc/uptime does not exist.');

            return 'Unknown';
        }

        // Seconds
        list($seconds) = explode(' ', $contents, 1);

        // Get it textual, as in days/minutes/hours/etc
        $uptime = Common::secondsConvert(ceil($seconds));

        // Now find out when the system was booted
        $contents = Common::getContents('/proc/stat', false);

        // Ugh
        if ($contents === false) {
            return $uptime;
        } // Settle for just uptime

        // Get date of boot
        if (preg_match('/^btime (\d+)$/m', $contents, $boot) != 1) {
            return $uptime;
        }

        // Okay?
        list(, $boot) = $boot;

        return array(
            'text' => $uptime,
            'bootedTimestamp' => $boot,
        );
    }
public function getUpTime()
    {

        // Time?
        if (!empty($this->settings['timer'])) {
            $t = new Timer('Uptime');
        }

        // Get contents
        $contents = Common::getContents('/proc/uptime', false);

        // eh?
        if ($contents === false) {
            Errors::add('Linfo Core', '/proc/uptime does not exist.');

            return 'Unknown';
        }

        // Seconds
        list($seconds) = explode(' ', $contents, 1);

        // Get it textual, as in days/minutes/hours/etc
        $uptime = Common::secondsConvert(ceil($seconds));

        // Now find out when the system was booted
        $contents = Common::getContents('/proc/stat', false);

        // Ugh
        if ($contents === false) {
            return $uptime;
        } // Settle for just uptime

        // Get date of boot
        if (preg_match('/^btime (\d+)$/m', $contents, $boot) != 1) {
            return $uptime;
        }

        // Okay?
        list(, $boot) = $boot;

        return array(
            'text' => $uptime,
            'bootedTimestamp' => $boot,
        );
    }
public function getUpTime ( ) { // Time? if ( ! empty ( $ this -> settings [ 'timer' ] ) ) { $ t = new Timer ( 'Uptime' ) ; } // Get contents $ contents = Common :: getContents ( '/proc/uptime' , false ) ; // eh? if ( $ contents === false ) { Errors :: add ( 'Linfo Core' , '/proc/uptime does not exist.' ) ; return 'Unknown' ; } // Seconds list ( $ seconds ) = explode ( ' ' , $ contents , 1 ) ; // Get it textual, as in days/minutes/hours/etc $ uptime = Common :: secondsConvert ( ceil ( $ seconds ) ) ; // Now find out when the system was booted $ contents = Common :: getContents ( '/proc/stat' , false ) ; // Ugh if ( $ contents === false ) { return $ uptime ; } // Settle for just uptime // Get date of boot if ( preg_match ( '/^btime (\d+)$/m' , $ contents , $ boot ) != 1 ) { return $ uptime ; } // Okay? list ( , $ boot ) = $ boot ; return array ( 'text' => $ uptime , 'bootedTimestamp' => $ boot , ) ; }
Famously interesting uptime
Famously interesting uptime