Compute the absolute ttl by adding the ttl to the current height of the chain

@param {number} ttl
@param {boolean} relative ttl is absolute or relative(default: true(relative))
@return {number} Absolute Ttl
546019
async function calculateTtl (ttl = 0, relative = true) {
  if (ttl === 0) return 0
  if (ttl < 0) throw new Error('ttl must be greater than 0')

  if (relative) {
    const { height } = await this.api.getCurrentKeyBlock()
    return +(height) + ttl
  }
  return ttl
}
375734
def _ttl(self):
        """"""
        return self.hlim if isinstance(self, scapy.layers.inet6.IPv6) else self.ttl
801122
def set_ttl(self, ttl):
        """"""
        if self._client._session_timeout != ttl:
            self._client._session_timeout = ttl
            self._client.restart()
            return True
1108598
public void createDir(String key, int ttl, Boolean prevExist) throws EtcdClientException {
        Preconditions.checkNotNull(key);

        List<BasicNameValuePair> data = Lists.newArrayList();
        data.add(new BasicNameValuePair("dir", String.valueOf(true)));
        if (ttl > 0) {
            data.add(new BasicNameValuePair("ttl", String.valueOf(ttl)));
        }
        if (prevExist != null) {
            data.add(new BasicNameValuePair("prevExist", String.valueOf(prevExist)));
        }

        put(key, data, null, new int[]{200, 201});
    }
682891
function absoluteUrl (baseUrl, pathUrl) {
  if (pathUrl && pathUrl.slice(0, 4) !== 'http') {
    return [baseUrl, pathUrl].map((path) => {
      if (path[0] === '/') {
        path = path.slice(1)
      }
      if (path[path.length - 1] === '/') {
        path = path.slice(0, path.length - 1)
      }
      return path
    }).join('/')
  }

  return pathUrl
}
249719
function legacyify(record) {
    var clone = record.clone();
    clone.isUnique = false;
    clone.ttl = 10;
    return clone;
  }
1172856
function positionToPercent(position) {
      var offset = vertical ? sliderDimensions.top : sliderDimensions.left;
      var size = vertical ? sliderDimensions.height : sliderDimensions.width;
      var calc = (position - offset) / size;

      if (!vertical && $mdUtil.bidi() === 'rtl') {
        calc = 1 - calc;
      }

      return Math.max(0, Math.min(1, vertical ? 1 - calc : calc));
    }
474832
def lmx_relative():
  """"""
  hparams = lmx_base()
  hparams.self_attention_type = "dot_product_relative_v2"
  hparams.activation_dtype = "float32"
  hparams.weight_dtype = "float32"
  return hparams
1298184
@Nonnull
  public TypeaheadPrefetch setTTL (@Nonnegative final int nTTL)
  {
    if (nTTL < 1)
      throw new IllegalArgumentException ("TTL is too small: " + nTTL);
    m_nTTL = nTTL;
    return this;
  }
22914
protected function getCalculatedTtl($ttl)
    {
        $calculatedTtl = \strtotime(\sprintf('now +%s seconds', $ttl));
        if (0 == $ttl) {
            $calculatedTtl = \strtotime('now +10 years');
        }
        return $calculatedTtl;
    }
821314
function getTTL() {
	var ttl;

	if (mage.session) {
		ttl = mage.session.sessionTTL + 60;	// 1 minute safety margin
	} else {
		ttl = DEFAULT_TTL;
	}

	return ttl;
}
1121437
function relativePath(from, to) {
  // console.log('relativePath:from: ' + from);
  // console.log('relativePath:to: ' + to);
  var relative = path.relative(from, to);
  if (!relative || relative.length < 1) {
    return relative;
  }
  var first = relative.substr(0, 1);
  if (first !== '.' && first !== '/') {
    relative = './' + relative;
  }

  // especially used for windows
  relative = relative.split(path.sep).join('/');

  return relative;
}
55382
public function setTtl($ttl)
    {
        if (!is_null($ttl)) {
            if (!is_numeric($ttl) || (intval($ttl) < 1)) {
                throw new \InvalidArgumentException(sprintf('Invalid TTL: %s', $ttl));
            }

            $this->ttl = intval($ttl);
        } else {
            $this->ttl = null;
        }

        return $this;
    }
736538
public static int getRealLeft(boolean isRtl, int parentLeft, int parentWidth, int left, int width) {
        if (isRtl) {
            // 1, trim the parent's left.
            left -= parentLeft;
            // 2, calculate the RTL left.
            left = parentWidth - width - left;
            // 3, add the parent's left.
            left += parentLeft;
        }
        return left;
    }
1259528
function(relative) {
    var base = this;           // The base url we're resolving against
    var r = new URL(relative); // The relative reference url to resolve
    var t = new URL();         // The absolute target url we will return

    if (r.scheme !== undefined) {
      t.scheme = r.scheme;
      t.username = r.username;
      t.password = r.password;
      t.host = r.host;
      t.port = r.port;
      t.path = remove_dot_segments(r.path);
      t.query = r.query;
    }
    else {
      t.scheme = base.scheme;
      if (r.host !== undefined) {
        t.username = r.username;
        t.password = r.password;
        t.host = r.host;
        t.port = r.port;
        t.path = remove_dot_segments(r.path);
        t.query = r.query;
      }
      else {
        t.username = base.username;
        t.password = base.password;
        t.host = base.host;
        t.port = base.port;
        if (!r.path) { // undefined or empty
          t.path = base.path;
          if (r.query !== undefined)
            t.query = r.query;
          else
            t.query = base.query;
        }
        else {
          if (r.path.charAt(0) === "/") {
            t.path = remove_dot_segments(r.path);
          }
          else {
            t.path = merge(base.path, r.path);
            t.path = remove_dot_segments(t.path);
          }
          t.query = r.query;
        }
      }
    }
    t.fragment = r.fragment;

    return t.toString();


    function merge(basepath, refpath) {
      if (base.host !== undefined && !base.path)
        return "/" + refpath;

      var lastslash = basepath.lastIndexOf("/");
      if (lastslash === -1)
        return refpath;
      else
        return basepath.substring(0, lastslash+1) + refpath;
    }

    function remove_dot_segments(path) {
      if (!path) return path; // For "" or undefined

      var output = "";
      while(path.length > 0) {
        if (path === "." || path === "..") {
          path = "";
          break;
        }

        var twochars = path.substring(0,2);
        var threechars = path.substring(0,3);
        var fourchars = path.substring(0,4);
        if (threechars === "../") {
          path = path.substring(3);
        }
        else if (twochars === "./") {
          path = path.substring(2);
        }
        else if (threechars === "/./") {
          path = "/" + path.substring(3);
        }
        else if (twochars === "/." && path.length === 2) {
          path = "/";
        }
        else if (fourchars === "/../" ||
             (threechars === "/.." && path.length === 3)) {
          path = "/" + path.substring(4);

          output = output.replace(/\/?[^\/]*$/, "");
        }
        else {
          var segment = path.match(/(\/?([^\/]*))/)[0];
          output += segment;
          path = path.substring(segment.length);
        }
      }

      return output;
    }
  }
775794
def _add_ttl_ns(self, line):
        
        lg = logging.getLogger("%s.%s" % (self.ln, inspect.stack()[0][3]))
        lg.setLevel(self.log_level)

        lg.debug("line:\n%s", line)
        line = str(line).strip()
        # if the line is not a prefix line exit
        if line is None or line == 'none' or line == '' \
                or not line.lower().startswith('@prefix'):
            return
        # parse the turtle line
        line = line.replace("@prefix","",1).strip()
        if line.endswith("."):
            line = line[:-1]
        prefix = line[:line.find(":")].strip()
        uri = self.clean_iri(line[line.find(":")+1:].strip())
        # add the namespace to the class
        lg.debug("\nprefix: %s  uri: %s", prefix, uri)
        self.bind(prefix, uri, override=False, calc=False)
738442
protected function normalizeTtl(&$ttl)
    {
        if (!is_int($ttl)) {
            $ttl = (float)$ttl;

            // convert to int if possible
            if ($ttl === (float)(int)$ttl) {
                $ttl = (int)$ttl;
            }
        }

        if ($ttl < 0) {
            throw new InvalidArgumentException("TTL can't be negative");
        }
    }