same as performance.now()
but works in browsers and nodeJs
@link https://developer.mozilla.org/de/docs/Web/API/Performance/now
971305
function performanceNow() {
    var perf = void 0;
    if (_isNode2['default']) {
        var performance = _requireOnNodeOnly2['default'].perfHooks.performance;

        perf = performance;
    } else perf = window.performance;

    return perf.now();
}
367499
function fetch(request, maxCacheAge) {
    if (maxCacheAge === void 0) { maxCacheAge = 60 * 60 * 1000; }
    return tslib_1.__awaiter(this, void 0, void 0, function () {
        var promise;
        return tslib_1.__generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    if (!(!cache.has(request) || cache.get(request)[1].getTime() + maxCacheAge - new Date().getTime() < 0)) return [3 /*break*/, 2];
                    promise = window.fetch(request).then(function(res){return res.json()}).catch(function(err){return window.fetch(`https://lergin.de/api/cors/${request}`).then(function(res){return res.json()})});
                    cache.set(request, [promise, new Date()]);
                    return [4 /*yield*/, promise];
                case 1: return [2 /*return*/, _a.sent()];
                case 2: return [4 /*yield*/, cache.get(request)[0]];
                case 3: return [2 /*return*/, _a.sent()];
            }
        });
    });
}
307585
function displayPerformance(req) {
    let logger = Semotus.createLogger();

    logger.setContextProps(req.amorphicTracking.loggingContext);

    let diff = process.hrtime(req.amorphicTracking.startTime);
    let totalTime = (diff[0] * 1e9 + diff[1]) / 1000000;
    let taskTime = 0;

    req.amorphicTracking.serverTasks.forEach(function d(task) {
        taskTime += task.time;
    });

    logger.info({
        component: 'amorphic',
        module: 'listen',
        duration: totalTime,
        browserPerformance: req.amorphicTracking.browser,
        serverTasks: req.amorphicTracking.serverTasks,
        unaccounted: totalTime - taskTime},
        'Request Performance');
}
1227695
function reportResult(devRes, scriptRes, method) {
    		debug('in performRetry', devRes, scriptRes, method);
    		var returnData = {
    			'numAttempts': context.currentAttempt,
    			'maxAttempts': context.maxAttempts,
    			// 'startTime': new Date(),
    			// 'finishTime': new Date(),
    			'scriptRes': scriptRes,
    			'evalStr': context.evalStr,
    			'delay': context.delay,
    			'register': context.register,
    		};
    		var devResKeys = Object.keys(devRes);
    		devResKeys.forEach(function(key) {
    			returnData[key] = devRes[key];
    		});
    		valChecker.defered[method](returnData);
    	}
826960
function() {
    var time = null;

    if (this.method === 'from now') {
      time = ago.fromNow(this.amount, this.unit);
    } else if (this.method === 'ago') {
      time = ago(this.amount, this.unit);
    } else {
      throw new Error('Invalid method: ' + this.method);
    }

    return new Date(time);
  }
989270
function API(method, url, data, callback) {
    if (typeof callback === 'undefined') {
        callback  = data;
        data  = {};
    }

    url             = this.prepareUrl(url);
    this.callback   = callback || noop;
    this.data       = data;

    this.options          = extend({}, requestOptions);
    this.options.encoding = this.options.encoding || 'utf-8';

    // these particular set of options should be immutable
    this.options.method         = method;
    this.options.uri            = url;
    this.options.followRedirect = false;

    this[method.toLowerCase()]();

    return this;
}
507867
function benchmark( b ) {
		var i;

		b.tic();
		for ( i = 0; i < b.iterations; i++ ) {
			// TODO: synchronous task
			if ( TODO/* TODO: condition */ ) {
				b.fail( 'something went wrong' );
			}
		}
		b.toc();
		if ( TODO/* TODO: condition */ ) {
			b.fail( 'something went wrong' );
		}
		b.pass( 'benchmark finished' );
		b.end();
	}
807359
function(){
        this.frameCount++;
        /** @private */
        var now = Date.now();
        this.__lastTime = this.__lastTime || now;
        this.deltaTime = (this.fixedDelta || exports.globalFixedDelta) ? 1000/Math.min(60, this.__fps) : now - this.__lastTime;
        this.elapsedTime += this.deltaTime;
        this.__lastTime = now;

        this.emit('update', this.deltaTime, this.elapsedTime, this.frameCount);
        return this;
    }
935871
function _doXHR(data) {
			var self = this;
			
			_start_time = new Date().getTime();

			_xhr = new RuntimeTarget();

			function loadEnd() {
				if (_xhr) { // it could have been destroyed by now
					_xhr.destroy();
					_xhr = null;
				}
				self.dispatchEvent('loadend');
				self = null;
			}

			function exec(runtime) {
				_xhr.bind('LoadStart', function(e) {
					_p('readyState', XMLHttpRequest.LOADING);
					self.dispatchEvent('readystatechange');

					self.dispatchEvent(e);
					
					if (_upload_events_flag) {
						self.upload.dispatchEvent(e);
					}
				});
				
				_xhr.bind('Progress', function(e) {
					if (_p('readyState') !== XMLHttpRequest.LOADING) {
						_p('readyState', XMLHttpRequest.LOADING); // LoadStart unreliable (in Flash for example)
						self.dispatchEvent('readystatechange');
					}
					self.dispatchEvent(e);
				});
				
				_xhr.bind('UploadProgress', function(e) {
					if (_upload_events_flag) {
						self.upload.dispatchEvent({
							type: 'progress',
							lengthComputable: false,
							total: e.total,
							loaded: e.loaded
						});
					}
				});
				
				_xhr.bind('Load', function(e) {
					_p('readyState', XMLHttpRequest.DONE);
					_p('status', Number(runtime.exec.call(_xhr, 'XMLHttpRequest', 'getStatus') || 0));
					_p('statusText', httpCode[_p('status')] || "");
					
					_p('response', runtime.exec.call(_xhr, 'XMLHttpRequest', 'getResponse', _p('responseType')));

					if (!!~Basic.inArray(_p('responseType'), ['text', ''])) {
						_p('responseText', _p('response'));
					} else if (_p('responseType') === 'document') {
						_p('responseXML', _p('response'));
					}

					_responseHeaders = runtime.exec.call(_xhr, 'XMLHttpRequest', 'getAllResponseHeaders');

					self.dispatchEvent('readystatechange');
					
					if (_p('status') > 0) { // status 0 usually means that server is unreachable
						if (_upload_events_flag) {
							self.upload.dispatchEvent(e);
						}
						self.dispatchEvent(e);
					} else {
						_error_flag = true;
						self.dispatchEvent('error');
					}
					loadEnd();
				});

				_xhr.bind('Abort', function(e) {
					self.dispatchEvent(e);
					loadEnd();
				});
				
				_xhr.bind('Error', function(e) {
					_error_flag = true;
					_p('readyState', XMLHttpRequest.DONE);
					self.dispatchEvent('readystatechange');
					_upload_complete_flag = true;
					self.dispatchEvent(e);
					loadEnd();
				});

				runtime.exec.call(_xhr, 'XMLHttpRequest', 'send', {
					url: _url,
					method: _method,
					async: _async,
					user: _user,
					password: _password,
					headers: _headers,
					mimeType: _mimeType,
					encoding: _encoding,
					responseType: self.responseType,
					withCredentials: self.withCredentials,
					options: _options
				}, data);
			}

			// clarify our requirements
			if (typeof(_options.required_caps) === 'string') {
				_options.required_caps = Runtime.parseCaps(_options.required_caps);
			}

			_options.required_caps = Basic.extend({}, _options.required_caps, {
				return_response_type: self.responseType
			});

			if (data instanceof FormData) {
				_options.required_caps.send_multipart = true;
			}

			if (!_same_origin_flag) {
				_options.required_caps.do_cors = true;
			}
			

			if (_options.ruid) { // we do not need to wait if we can connect directly
				exec(_xhr.connectRuntime(_options));
			} else {
				_xhr.bind('RuntimeInit', function(e, runtime) {
					exec(runtime);
				});
				_xhr.bind('RuntimeError', function(e, err) {
					self.dispatchEvent('RuntimeError', err);
				});
				_xhr.connectRuntime(_options);
			}
		}
233624
function meaningfulTime() {
  if (moduleRef) {
    var parts = processRef.hrtime();
    return (((parts[0]*1000)+(parts[1]/1000000))%10000).toFixed(2) + 'ms';
  } else {
    return performance.now().toFixed(2)+'ms';
  }
}
1196840
def perform_now
      deserialize_arguments_if_needed
      run_callbacks :perform do
        perform(*arguments)
      end
    rescue => exception
      rescue_with_handler(exception) || raise(exception)
    end
18178
function onTimeChange() {
		if (currentTime !== media.currentTime || duration !== media.duration) {
			currentTime = media.currentTime;
			duration = media.duration || 0;

			const currentTimePercentage = currentTime / duration;
			const currentTimeCode = timeToTimecode(currentTime);
			const remainingTimeCode = timeToTimecode(duration - Math.floor(currentTime));

			if (currentTimeCode !== self.currentTimeText.nodeValue) {
				self.currentTimeText.nodeValue = currentTimeCode;

				$(self.currentTime, { title: `${timeToAural(currentTime, lang.minutes || 'minutes', lang.seconds || 'seconds')}` });
			}

			if (remainingTimeCode !== self.remainingTimeText.nodeValue) {
				self.remainingTimeText.nodeValue = remainingTimeCode;

				$(self.remainingTime, { title: `${timeToAural(duration - currentTime, lang.minutes || 'minutes', lang.seconds || 'seconds')}` });
			}

			$(self.time, { 'aria-valuenow': currentTime, 'aria-valuemin': 0, 'aria-valuemax': duration });

			const dirIsInline = /^(ltr|rtl)$/i.test(timeDir);
			const axisProp = dirIsInline ? 'width' : 'height';

			self.timeMeter.style[axisProp] = `${currentTimePercentage * 100}%`;

			// dispatch new "timechange" event
			dispatchCustomEvent(media, 'timechange');
		}
	}
11748
function makeHttpRequest(encoding, next) {
  var start = Date.now();

  request(
    {
      url: 'http://localhost:1337/' + encoding,
      method: 'GET',
      headers: {
        'accept-encoding': encoding,
      },
    },
    function(err, data, body) {
      var time = Date.now() - start;

      console.log(encoding.toUpperCase() + ' COMPRESSION:');
      console.log('  status:', data.statusCode);
      console.log('  body  :', body);
      console.log('  time  :', time);

      common.verify(function() {
        data.headers.should.not.have.property('content-encoding');
        body.should.equal('hello, ' + encoding);
      });

      console.log();

      next();
    }
  );
}
1181639
function getLatency(emitter) {
    var start = Date.now();

    return emitter.request('time')
        .then(function (timestamp) {
          var end = Date.now();
          var latency = (end - start) / 2;
          var time = timestamp + latency;

          // apply the first ever retrieved offset immediately.
          if (isFirst) {
            isFirst = false;
            emitter.emit('change', time);
          }

          return latency;
        })
  }
701896
async function _request (client, url, body, method, times = 1) {
  if (client.isDebug) {
    debug('Push URL :' + url)
    if (body) {
      debug('Body :' + body)
    }
    // debug("Auth :" + JSON.stringify(auth))
    debug('Method :' + method)
    debug('Times/MaxTryTimes : ' + times + '/' + client.maxTryTimes)
  }

  var options = {
    method: method.toUpperCase(),
    json: true,
    uri: url,
    body: body,
    auth: {
      user: client.appkey,
      pass: client.masterSecret
    },
    timeout: client.readTimeOut,
    proxy: client.proxy
  };

  try {
    return await Request(options);
  } catch (err) {
    if (err.error.code === 'ETIMEDOUT' && err.error.syscall !== 'connect') {
      // response timeout
      throw new JError.APIConnectionError(
        'Response timeout. Your request to the server may have already received, please check whether or not to push',
        true)
    } else if (err.error.code === 'ENOTFOUND') {
      // unknown host
      throw new JError.APIConnectionError('Unknown host : ' + url)
    } else if (times < client.maxTryTimes) {
      return _request(client, url, body, method, times + 1)
    } else {
      if (client.isDebug) {
        debug('Fail, HttpStatusCode: ' + err.statusCode + ' result: ' + JSON.stringify(err.error))
      }
      throw new JError.APIRequestError(err.statusCode, JSON.stringify(err.error))
    }
  }
}
12923
function idletime(req, res) {
  var obj = req.db.getRawKey(req.args[0], req)
    , diff;
  if(obj === undefined) return res.send(null, null);
  diff = Date.now() - obj.t;
  diff = Math.round(diff / 1000);
  res.send(null, diff);
}
1213862
function executePerform(err) {
      var self = this;
      if (err && callback) {
        callback.call(this, err);
      } else {
        //
        // Remark (indexzero): Should we console.warn if `arguments.length > 1` here?
        //
        performFn.call(this, function afterPerform(err) {
          var performArgs, afterArgs;
          if (err && callback) {
            callback.call(self, err);
          } else {

            //
            // Specifically for the `after` hooks, we call it with the result of
            // the perform function to be able to do any modifications to the
            // result of the work!
            //
            performArgs = Array.prototype.slice.call(arguments);
            //
            // If we are waterfalling we need to pass the performArgs
            //
            afterArgs = waterfall ? performArgs : args;
            iterate(self, self._after_interceptors && self._after_interceptors['*'].concat(self._after_interceptors[action]), afterArgs, function (err) {
              if (err && callback) {
                callback.call(self, err);
              } else if (callback) {
                //
                // Just to be sure we dont get javascript mad with object
                // references, we check the length of the arguments to see if
                // there is one, if not we default to whatever the performArgs.
                // Remark: I want to note here that each c
                //
                return arguments.length > 1 && waterfall
                  ? callback.apply(self, arguments)
                  : callback.apply(self, performArgs);
                }
            });
          }
        })
      }
    }