UpTime
time the system is running

@return void
322828
private function _uptime()
    {
        $s = preg_split('/ /', $this->grabkey('kern.boottime'));
        $a = preg_replace('/,/', '', $s[3]);
        $this->sys->setUptime(time() - $a);
    }
936902
public function getServerTime()
    {
        $response = $this->getConnection()->get(Urls::URL_ADMIN_TIME);
        $data     = $response->getJson();

        return $data['time'];
    }
124864
private function setup()
    {
        $config = $this->config();
        date_default_timezone_set($config['timezone']);

        // Setup routes
        $this->routeManager()->setupRoutes();

        // Setup modules
        $this->setupModules();

        // Setup routable (if not running CLI mode)
        if (PHP_SAPI !== 'cli') {
            $this->setupRoutables();
        }

        // Setup middlewares
        $this->setupMiddlewares();
    }
758781
public function timer_start()
    {
        $PAGELOADTIME = microtime();
        $PAGELOADTIME = explode(' ', $PAGELOADTIME);
        $PAGELOADTIME = $PAGELOADTIME[1] + $PAGELOADTIME[0];
        $this->basetime = $PAGELOADTIME;
    }
781647
private function runHousekeeping(): void
    {
        $data_filesystem = app(FilesystemInterface::class);
        $root_filesystem = new Filesystem(new Local(Webtrees::ROOT_DIR));

        // Clear files in the (user-specified) data folder - which might not be local files
        $this->housekeeping_service->deleteOldFiles($data_filesystem, 'cache', self::MAX_CACHE_AGE);

        $this->housekeeping_service->deleteOldFiles($data_filesystem, 'thumbnail-cache', self::MAX_THUMBNAIL_AGE);

        // Clear files in /data - which need to be local files
        $this->housekeeping_service->deleteOldFiles($root_filesystem, self::TMP_DIR, self::MAX_TMP_FILE_AGE);

        // Clear entries in database tables
        $this->housekeeping_service->deleteOldLogs(self::MAX_LOG_AGE);

        $this->housekeeping_service->deleteOldSessions(self::MAX_SESSION_AGE);
    }
735252
private function _uptime()
    {
        if (CommonFunctions::executeProgram('uptime', '', $buf)) {
            if (preg_match("/up (\d+) day[s]?,\s*(\d+):(\d+),/", $buf, $ar_buf)) {
                $min = $ar_buf[3];
                $hours = $ar_buf[2];
                $days = $ar_buf[1];
                $this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60);
            } elseif (preg_match("/up (\d+):(\d+),/", $buf, $ar_buf)) {
                $min = $ar_buf[2];
                $hours = $ar_buf[1];
                $this->sys->setUptime($hours * 3600 + $min * 60);
            }
        }
    }
8551
private function _uptime()
    {
        $result = 0;
        date_default_timezone_set('UTC');
        $buffer = $this->_get_Win32_OperatingSystem();
        if ($buffer && ($buffer[0]['LastBootUpTime'] !== null)) {
            $local = $buffer[0]['LocalDateTime'];
            $boot = $buffer[0]['LastBootUpTime'];

            $lyear = intval(substr($local, 0, 4));
            $lmonth = intval(substr($local, 4, 2));
            $lday = intval(substr($local, 6, 2));
            $lhour = intval(substr($local, 8, 2));
            $lminute = intval(substr($local, 10, 2));
            $lseconds = intval(substr($local, 12, 2));
            $loffset = intval(substr($boot, 21, 4));

            $byear = intval(substr($boot, 0, 4));
            $bmonth = intval(substr($boot, 4, 2));
            $bday = intval(substr($boot, 6, 2));
            $bhour = intval(substr($boot, 8, 2));
            $bminute = intval(substr($boot, 10, 2));
            $bseconds = intval(substr($boot, 12, 2));
            $boffset = intval(substr($boot, 21, 4));

            if (version_compare($buffer[0]['Version'], "5.1", "<")) { // fix LastBootUpTime on Windows 2000 and older
                $boffset += $boffset;
            }

            $localtime = mktime($lhour, $lminute, $lseconds, $lmonth, $lday, $lyear) - $loffset*60;
            $boottime = mktime($bhour, $bminute, $bseconds, $bmonth, $bday, $byear) - $boffset*60;

            $result = $localtime - $boottime;

            $this->sys->setUptime($result);
        } elseif (($this->sys->getDistribution()=="ReactOS") && CommonFunctions::executeProgram('uptime', '', $strBuf, false) && (strlen($strBuf) > 0) && preg_match("/^System Up Time:\s+(\d+) days, (\d+) Hours, (\d+) Minutes, (\d+) Seconds/", $strBuf, $ar_buf)) {
            $sec = $ar_buf[4];
            $min = $ar_buf[3];
            $hours = $ar_buf[2];
            $days = $ar_buf[1];
            $this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60 + $sec);
        }
    }
308214
protected function uptimeInSeconds($date)
    {
        return
            (isset($date['up_days']) ? $date['up_days'] * 24 * 60 : 0) +
            (isset($date['up_hours']) ? $date['up_hours'] * 60 : 0) +
            (isset($date['up_minutes']) ? $date['up_minutes'] : 0);
    }
729821
public function started()
	{
		// If it doesn't exist or isn't published
		if ($this->isNew())
		{
			return false;
		}

		if ($this->get('publish_up')
		 && $this->get('publish_up') != '0000-00-00 00:00:00'
		 && $this->get('publish_up') > Date::toSql())
		{
			return false;
		}

		return true;
	}
746328
private function updateRemainingTime()
    {
        $result = null;
        $remaining = 0;
        $hasTimer = false;

        $session = $this->getTestSession();

        if ($session !== null && $session->isRunning()) {
            $remaining = PHP_INT_MAX;
            $timeConstraints = $session->getTimeConstraints();
            foreach ($timeConstraints as $tc) {
                // Only consider time constraints in force.
                $maximumRemainingTime = $tc->getMaximumRemainingTime();
                if ($maximumRemainingTime !== false) {
                    $hasTimer = true;
                    $remaining = min($remaining, $maximumRemainingTime->getSeconds(true));
                }
            }
        }

        if ($hasTimer) {
            $result = $remaining;
        }

        $this->addValue(DeliveryMonitoringService::REMAINING_TIME, $result, true);
    }
39348
protected function formatUptime($uptime )
   {
     $days = floor($uptime / 24 / 60 / 60);
     $daysRemainder = $uptime - ($days * 24 * 60 * 60);
     $hours = floor($daysRemainder / 60 / 60);
     $hoursRemainder = $daysRemainder - ($hours * 60 * 60);
     $minutes = floor($hoursRemainder / 60);
     $minutesRemainder = $hoursRemainder - ($minutes * 60);
     $seconds = $minutesRemainder;

     $out = $uptime . ' seconds (';
     if ($days > 0) {
         $out .= $days . ' days, ';
     }
     if ($hours > 0) {
         $out .= $hours . ' hours, ';
     }
     if ($minutes > 0) {
         $out .= $minutes . ' minutes, ';
     }
     if ($seconds > 0) {
         $out .= $seconds . ' seconds';
     }

     return $out . ')';
   }
355425
public static function start()
    {

        static::$time = microtime(true);
        static::$memory = memory_get_usage(true);

        self::log(static::$time, _t("Start execution time"), "info");
    }
908709
private static function execution_time(){
        if (self::$execution_time === 0){
            self::$execution_time = -microtime(true);
        }else{
            self::$execution_time += microtime(true);
        }
        return self::$execution_time;
    }
738202
public function onReady()
    {
        if ($this->isEnabled()) {
            $this->updateTimer = setTimeout(function ($timer) {
                $this->updateAllServers();
                $timer->timeout(2e6);
            }, 1);
        }
    }
695561
public function refreshInfo() {

		// Get the Server Statistics
		$this->statistics = $this->call('stats');

		// Extract the statistics variables and store them as properties of the class instance
		$this->uptime		= ( isset($this->statistics['uptime']) 		? $this->statistics['uptime'] : 	0  );
		$this->playtime		= ( isset($this->statistics['playtime']) 	? $this->statistics['playtime'] : 	0  );
		$this->artists		= ( isset($this->statistics['artists']) 	? $this->statistics['artists'] : 	0  );
		$this->albums		= ( isset($this->statistics['albums']) 		? $this->statistics['albums'] : 	0  );
		$this->songs		= ( isset($this->statistics['songs']) 		? $this->statistics['songs'] : 		0  );
		$this->db_playtime	= ( isset($this->statistics['db_playtime']) 	? $this->statistics['db_playtime'] : 	0  );
		$this->db_update	= ( isset($this->statistics['db_update']) 	? $this->statistics['db_update'] : 	0  );

		// Get the Server Status
		$this->status = $this->call('status');

		Log::info('LxMPD->refreshInfo() - this->status', array($this->status));

		// Get the Playlist
		$this->playlist['tracks'] = $this->call('playlistinfo');

        	// Let's store the state for easy access as a property
		$this->state = ( isset($this->status['state'] ) ? $this->status['state'] : 'stop' );

		// If the state is play or pause then we want to create some custom properties for easier access to certain stats
		if ( ($this->state == "play") || ($this->state == "pause") ) {

			$this->current_track_id = $this->status['song'];

			Log::info('LxMPD->refreshInfo() - current_track_id', array($this->current_track_id));

			list ($this->current_track_position, $this->current_track_length ) = explode(":", $this->status['time']);

		} else {

			$this->current_track_id = 0;
			$this->current_track_position = 0;
			$this->current_track_length = 0;
		}

		// Extract out all of the status variables and store them as properties of the class instance
		$this->repeat		= ( isset($this->status['repeat']) 		? $this->status['repeat'] : 		0  );
		$this->random		= ( isset($this->status['random']) 		? $this->status['random'] : 		0  );
		$this->single		= ( isset($this->status['single']) 		? $this->status['single'] : 		0  );
		$this->consume		= ( isset($this->status['consume']) 		? $this->status['consume'] : 		0  );
		$this->volume		= ( isset($this->status['volume']) 		? $this->status['volume'] : 		0  );
		$this->xfade 		= ( isset($this->status['xfade']) 		? $this->status['xfade'] : 		0  );
		$this->mixrampdb 	= ( isset($this->status['mixrampdb']) 		? $this->status['mixrampdb'] : 		0  );
		$this->mixrampdelay 	= ( isset($this->status['mixrampdelay']) 	? $this->status['mixrampdelay'] : 	0  );
		$this->playlist_id 	= ( isset($this->status['playlist']) 		? $this->status['playlist'] : 		0  );
		$this->playlist_length 	= ( isset($this->status['playlist_length']) 	? $this->status['playlist_length'] : 	0  );
		$this->song 		= ( isset($this->status['song']) 		? $this->status['song'] : 		0  );
		$this->songid 		= ( isset($this->status['songid']) 		? $this->status['songid'] : 		0  );
		$this->nextsong 	= ( isset($this->status['nextsong']) 		? $this->status['nextsong'] : 		0  );
		$this->nextsongid 	= ( isset($this->status['nextsongid']) 		? $this->status['nextsongid'] : 	0  );
		$this->time 		= ( isset($this->status['time']) 		? $this->status['time'] : 		0  );
		$this->elapsed		= ( isset($this->status['elapsed'])		? $this->status['elapsed'] : 		0  );
		$this->bitrate 		= ( isset($this->status['bitrate']) 		? $this->status['bitrate'] : 		0  );
		$this->audio	 	= ( isset($this->status['audio']) 		? $this->status['audio'] : 		'' );
	}
1027352
protected function updateTimestamps()
    {
        $time = $this->freshTimestamp();

        if (! is_null(static::UPDATED_AT) && ! $this->hasChanged(static::UPDATED_AT)) {
            $this->setUpdatedAt($time);
        }

        if (! $this->exists && ! is_null(static::CREATED_AT) &&
            ! $this->hasChanged(static::CREATED_AT)) {
            $this->setCreatedAt($time);
        }
    }
520060
public function run()
	{
		Model::unguard();

        User::create([
            'name'       => 'Bob Bloom',
            'email'      => 'admin@example.org',
            'password'   => bcrypt('password'),
            'created_at' => new DateTime,
            'updated_at' => new DateTime,
        ]);

        Group::create([
            'title'       => 'Registered',
            'description' => 'Basic front-end access only.',
            'created_at' => new DateTime,
            'created_by' => 1,
            'updated_at' => new DateTime,
            'updated_by' => 1,
        ]);

        Group::create([
            'title'       => 'Administrator',
            'description' => 'Basic back-end administration access only.',
            'created_at' => new DateTime,
            'created_by' => 1,
            'updated_at' => new DateTime,
            'updated_by' => 1,
        ]);

        Group::create([
            'title'       => 'Super Administrator',
            'description' => 'Highest back-end administration access.',
            'created_at' => new DateTime,
            'created_by' => 1,
            'updated_at' => new DateTime,
            'updated_by' => 1,
        ]);


        User_group::create([
            'user_id'   => 1,
            'group_id'  => 1,
        ]);

        User_group::create([
            'user_id'   => 1,
            'group_id'  => 3,
        ]);

	}