Compute & set the refresh time

@access private
322056
function _setRefreshTime() 
    {
        if (is_null($this->_lifeTime)) {
            $this->_refreshTime = null;
        } else {
            $this->_refreshTime = time() - $this->_lifeTime;
        }
    }
1252499
public function elapsedTime() {
        $currentTime = microtime(true);
        if ($this->startTime === null) {
            $this->startTime            = $currentTime;
            $this->finishTime           = $currentTime;
        } else {
            $this->finishTime           = $currentTime;
            $this->elapsedTimeFromStart = $currentTime - $this->startTime;
        }
    }
956704
async def refresh(self):
        """"""
        raw_data = await self.request.get(self._resource_path, {"refresh": "true"})

        self._raw_data = raw_data[ATTR_SHADE]
219839
def set_refresh_interval(self, seconds, **kwargs):
        
        if seconds <= 0:
            interval = -1
        else:
            interval = text_type(seconds) + "s"

        if self.cluster.version.startswith("0.90."):
            response = self.cluster.put(
                "/" + self.settings.index + "/_settings",
                data='{"index":{"refresh_interval":' + value2json(interval) + '}}',
                **kwargs
            )

            result = json2value(utf82unicode(response.all_content))
            if not result.ok:
                Log.error("Can not set refresh interval ({{error}})", {
                    "error": utf82unicode(response.all_content)
                })
        elif self.cluster.version.startswith(("1.4.", "1.5.", "1.6.", "1.7.", "5.", "6.")):
            result = self.cluster.put(
                "/" + self.settings.index + "/_settings",
                data={"index": {"refresh_interval": interval}},
                **kwargs
            )

            if not result.acknowledged:
                Log.error("Can not set refresh interval ({{error}})", {
                    "error": result
                })
        else:
            Log.error("Do not know how to handle ES version {{version}}", version=self.cluster.version)
294918
public function refreshSession()
    {
        $this->objCurl = curl_init();
        $this->arrCurlOptions[CURLOPT_COOKIEJAR] = $this->strCookieFile;
        $this->arrCurlOptions[CURLOPT_COOKIEFILE] = $this->strCookieFile;
        curl_setopt_array($this->objCurl, $this->arrCurlOptions);
    }
1024157
public function doRefresh(){
		//Validating elements.  Should be already done but let's say on the safe side
		$this->form->validateElements();
		
		//If valid apply values to the accordion
		if($this->form->isValid()){
			foreach($this->form->getElements() as $element){
				$this->tabs->addParams($element->getName(), $element->getVal());
			}
		}
	}
607709
public function refresh() {
        $outdated = [];
        foreach ($this->cache as $uri => $i) {
            try {
                $i->getMetadata(true);
            } catch (NotFound $e) {
                $outdated[] = $uri;
            } catch (Deleted $e) {
                $outdated[] = $uri;
            }
        }
        foreach ($outdated as $uri) {
            unset($this->cache[$uri]);
            foreach ($this->uri2id[$uri] as $id) {
                unset($this->id2uri[$id]);
            }
            unset($this->uri2id[$uri]);
        }
    }
1257245
private void enableRefresh() {
        this.refreshButton.setEnabled(true);
        this.autoRefreshLabel.setEnabled(true);
        this.autoRefreshComboBox.setEnabled(true);
        updateAutoRefreshTimer();
    }
1281107
public function refresh() {
        global $CFG, $USER;
        if ($dir = opendir($this->dir)) {
            while (false !== ($file = readdir($dir))) {
                if (!is_dir($file) && $file != '.' && $file != '..') {
                    if (strpos($file, 'u'.$USER->id.'_') !== false) {
                        @unlink($this->dir.$file);
                    }
                }
            }
        }
    }
230220
protected function updateTimestamps()
    {
        $time = $this->freshTimestamp();

        if (! is_null($column = $this->getUpdatedAtColumn()) && ! $this->isDirty($column)) {
            $this->setAttribute($column, $time);
        }

        if (! $this->exists && ! is_null($column = $this->getCreatedAtColumn()) && ! $this->isDirty($column)) {
            $this->setAttribute($column, $time);
        }
    }
1114199
public function refresh()
    {
        $keyName = $this->keyName;

        //If we don't have a key we cant refresh
        if (! isset($this->$keyName))
        {
            return;
        }

        $dbItem = self::getOneByKey($this->getKey());

        //Check if we are already the same
        if ($dbItem == $this)
        {
            return;
        }

        //Get values from DB & check if they match. Update if needed
        foreach (get_object_vars($dbItem) as $var => $val)
        {
            if ($this->$var !== $val)
            {
                $this->$var = $val;
            }
        }
    }
1167473
public function refresh()
    {
        list($resp, $usedOpts) = self::request(self::METHOD_GET, self::instanceUrl());
        $body = isset($resp['data'][0]) ? $resp['data'][0] : null;
        $this->install($body, $usedOpts);
        return $this;
    }
1279703
def refresh(self):
        """"""
        keys = [self.name]
        args = [self.value, self.timeout]
        # Redis docs claim EVALs are atomic, and I'm inclined to believe it.
        if hasattr(self, '_refresh_script'):
            return self._refresh_script(keys=keys, args=args) == 1
        else:
            keys_and_args = keys + args
            return self.redis.eval(self.lua_refresh, len(keys), *keys_and_args)
305800
function() {
    var self = this;
    // delay to make sure the spinner has a chance to spin for a split second before it's dismissed
    var d = new Date();
    var delay = 0;
    if (self.refreshStartTime + self.__minSpinTime > d.getTime()){
      delay = self.refreshStartTime + self.__minSpinTime - d.getTime();
    }
    setTimeout(function(){
      if (self.__refreshTail){
        self.__refreshTail();
      }
      setTimeout(function(){
        self.__refreshActive = false;
        if (self.__refreshDeactivate) {
          self.__refreshDeactivate();
        }
        if (self.__refreshHide){
          self.__refreshHide();
        }

        self.scrollTo(self.__scrollLeft, self.__scrollTop, true);
      },self.__refreshTailTime);
    },delay);
  }
199452
protected function set_refresh_rate() {
        if (defined('BEHAT_SITE_RUNNING')) {
            // Hack for behat tests.
            $this->refresh = 5;
        } else {
            if (defined('REPORT_LOGLIVE_REFRESH')) {
                // Backward compatibility.
                $this->refresh = REPORT_LOGLIVE_REFERESH;
            } else {
                // Default.
                $this->refresh = 60;
            }
        }
    }
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);
        }
    }
805638
def check_if_ok_to_update(self):
        """"""
        current_time = int(time.time())
        last_refresh = self.last_refresh
        if last_refresh is None:
            last_refresh = 0
        if current_time >= (last_refresh + self.refresh_rate):
            return True
        return False