Class: NATS::MonotonicTime

Inherits:
Object show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/client.rb

Class Method Summary collapse

Class Method Details

.since(t0) ⇒ Object



1975
1976
1977
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/client.rb', line 1975

def since(t0)
  now - t0
end

.with_nats_timeout(timeout) ⇒ Object



1965
1966
1967
1968
1969
1970
1971
1972
1973
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/client.rb', line 1965

def with_nats_timeout(timeout)
  start_time = now
  yield
  end_time = now
  duration = end_time - start_time
  if duration > timeout
    raise NATS::Timeout.new("nats: timeout")
  end
end