Sha256: 9adaab021164f071a767adae51f1a9d9f4d41aadc2ca484ed7f3e3e7d0461d4b
Contents?: true
Size: 607 Bytes
Versions: 2
Compression:
Stored size: 607 Bytes
Contents
# frozen_string_literal: true # Copyright 2020 OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 module OpenTelemetry module Common # Utilities contains common helpers. module Utilities extend self # @api private # # Returns nil if timeout is nil, 0 if timeout has expired, or the remaining (positive) time left in seconds. def maybe_timeout(timeout, start_time) return nil if timeout.nil? timeout -= (Time.now - start_time) timeout.positive? ? timeout : 0 end end end end require_relative './http/client_context'
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
opentelemetry-common-0.10.0 | lib/opentelemetry/common/utilities.rb |
opentelemetry-common-0.9.0 | lib/opentelemetry/common/utilities.rb |