/*!
Returns the last visit timestamp to the current user.
14901
function lastVisit()
    {
        $db = eZDB::instance();

        $userVisitArray = $db->arrayQuery( "SELECT last_visit_timestamp FROM ezuservisit WHERE user_id=$this->ContentObjectID" );
        if ( isset( $userVisitArray[0] ) )
        {
            return $userVisitArray[0]['last_visit_timestamp'];
        }
        else
        {
            return time();
        }
    }
617460
public function actionLastLogins()
    {
        return UserLogin::find()->select(['user_id', 'max(timestamp_create) as maxdate'])->joinWith(['user' => function ($q) {
            $q->select(['id', 'firstname', 'lastname']);
        }])->limit(10)->groupBy(['user_id'])->orderBy(['maxdate' => SORT_DESC])->asArray()->all();
    }
632171
public static function updateLastVisit($event)
    {
        if ($event->isValid) {
            /**
             * @var User $user
             */
            $user = $event->identity;
            $user->last_visit_at = time();
            $user->updateAttributes(['last_visit_at']);
            return true;
        }
        return false;
    }
1109394
public function actionAdminLastActivity()
    {
        $rr = new RequestResponse();

        if (!\Yii::$app->user->isGuest) {
            $rr->data = (new UserLastActivityWidget())->getOptions();
        } else {
            $rr->data = [
                'isGuest' => true
            ];
        }


        return $rr;
    }
751370
public final function last(int $timeStamp = null): string
   {
       if ($timeStamp) {
           $this->lastModification = gmdate(
               "D, d M Y H:i:s",
               $timeStamp) . " GMT";
       }
       return $this->lastModification;
   }
729091
public function getLastModified()
	{
		if ($this->lastModified == null) {
			$this->requestHead();
		}
		return $this->lastModified == null ? new \DateTime() : $this->lastModified;
	}
500424
public function getLastActivityAttribute()
    {
        $activity = $this->activity;
        return ($activity instanceof UserActivity) ?
                Carbon::createFromFormat('Y-m-d H:i:s', $activity->last_activity) : null;
    }
683951
public static function lastActive()
    {
        $last = Podium::getInstance()->podiumCache->get('forum.lastactive');
        if ($last === false) {
            $time = time() - 15 * 60;
            $last = [
                'count' => static::find()->where(['>', 'updated_at', $time])->count(),
                'members' => static::find()->where(['and',
                        ['>', 'updated_at', $time],
                        ['is not', 'user_id', null],
                        ['anonymous' => 0]
                    ])->count(),
                'anonymous' => static::find()->where(['and',
                        ['>', 'updated_at', $time],
                        ['is not', 'user_id', null],
                        ['anonymous' => 1]
                    ])->count(),
                'guests' => static::find()->where(['and',
                        ['>', 'updated_at', $time],
                        ['user_id' => null]
                    ])->count(),
                'names' => [],
            ];
            $members = static::find()->where(['and',
                    ['>', 'updated_at', $time],
                    ['is not', 'user_id', null],
                    ['anonymous' => 0]
                ]);
            foreach ($members->each() as $member) {
                $last['names'][$member->user_id] = [
                    'name' => $member->username,
                    'role' => $member->user_role,
                    'slug' => $member->user_slug,
                ];
            }
            Podium::getInstance()->podiumCache->set('forum.lastactive', $last, 60);
        }
        return $last;
    }
179728
def last_update_time(self) -> float:
        """"""
        stdout = self.stdout_interceptor
        stderr = self.stderr_interceptor

        return max([
            self._last_update_time,
            stdout.last_write_time if stdout else 0,
            stderr.last_write_time if stderr else 0,
        ])
1043604
public function last() {
        if ($this->count()) {
            $this->current = $this->count() - 1;
            return $this->get($this->count() - 1);
        }
    }
1087525
public function setLastVisit($timestamp = 'now')
	{
		$timestamp = new Date($timestamp);

		$query = $this->getQuery()
			->update($this->getTableName())
			->set(array('lastvisitDate' => $timestamp->toSql()))
			->whereEquals('id', $this->get('id'));

		return $query->execute();
	}
426979
public function getLastAccessedAt() {
		$timestamp = fileatime($this->pathname);
		$time = new DateTime();
		$time->setTimestamp($timestamp);
		return $time;
	}
447704
public function getUsersActiveTimer($user_id)
    {
        $result = $this->getUserEntries( $user_id, Range::today( $this->_timeZone ) );
        if ( $result->isSuccess() ) {
            $data = null;
            foreach ($result->data as $entry) {
                if ($entry->timer_started_at != null || $entry->timer_started_at != "") {
                    $data = $entry;
                    break;
                }
            }
            $result->data = $data;
        }

        return $result;
    }
699884
function getTimeStamp() {
    return isBrowser && (window.performance || {}).now ? window.performance.now() : new Date().getTime();
}
557454
private function recentlyVisited()
    {
        $app = App::getInstance();

        if ($app['currentuser']->isLoggedIn()) {
            $sql = $app['safesql']->query(
                "SELECT
					COUNT(id)
				FROM
					`article_visit`
				WHERE user = '%s'
				AND article = '%s'
				AND `article_visit`.deleted = 0
				AND timestamp >= NOW() - INTERVAL 4 WEEK",
                array(
                    $app['currentuser']->getUser()->getUsername(),
                    $this->getId()
                )
            );
            return $app['db']->get_var($sql);
        } else {
            $sql = $app['safesql']->query(
                "SELECT
					COUNT(id)
				FROM
					`article_visit`
				WHERE IP = '%s'
				AND browser = '%s'
				AND article = %i
				AND `article_visit`.deleted = 0
				AND timestamp >= NOW() - INTERVAL 4 WEEK",
                array(
                    $app['env']['REMOTE_ADDR'],
                    $app['env']['HTTP_USER_AGENT'],
                    $this->getId()
                )
            );

            return $app['db']->get_var($sql);
        }
    }
1245533
def get_last_user(self, refresh=False):
        """"""
        if refresh:
            self.refresh_complex_value('sl_UserCode')
        val = self.get_complex_value("sl_UserCode")
        # Syntax string: UserID="<pin_slot>" UserName="<pin_code_name>"
        # See http://wiki.micasaverde.com/index.php/Luup_UPnP_Variables_and_Actions#DoorLock1

        try:
            # Get the UserID="" and UserName="" fields separately
            raw_userid, raw_username = val.split(' ')
            # Get the right hand value without quotes of UserID="<here>"
            userid = raw_userid.split('=')[1].split('"')[1]
            # Get the right hand value without quotes of UserName="<here>"
            username = raw_username.split('=')[1].split('"')[1]
        except Exception as ex:
            logger.error('Got unsupported user string {}: {}'.format(val, ex))
            return None

        return ( userid, username )
146665
public function touchLastSeen()
    {
        if ($this->isOnline()) {
            return;
        }

        $oldTimestamps = $this->timestamps;
        $this->timestamps = false;

        $this
            ->newQuery()
            ->where('id', $this->id)
            ->update(['last_seen' => $this->freshTimestamp()])
        ;

        $this->last_seen = $this->freshTimestamp();
        $this->timestamps = $oldTimestamps;
    }