timeouter 0.1.2.16523 → 0.1.2.38793

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -6
  3. data/lib/timeouter/timer.rb +2 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a86bbe556a4314efcba6fea76b7ae0189835803147b6f6eb683f734896b5cb2
4
- data.tar.gz: 7e25fec040281902bc629193b519722e02cd371b5b19d0498b756ffd117d6d16
3
+ metadata.gz: 597aa59fbdb2bb4df72bb4883bba84c02a31217a02fb843954ecd9c1cbd11e88
4
+ data.tar.gz: e350922ccb84f700c221e8bf1feb4b754712b45fcfa70ca5f8c94188bb9207e7
5
5
  SHA512:
6
- metadata.gz: 9e4000ec129ff0a9bd085b83c40c00381f45a969dbcbb207ce96696d9e0e5863b9a6637940512ce1e1729db02d53d97e7db6512a480d3a147e053eaf16155bbd
7
- data.tar.gz: abde00f9d748786fda36f149613a4a02195fa7ce6d16a05a4e177dd9e2475ebfc25dd28d93554d7817ac76b934a3c9438486142c325cfd72387866e41b389a87
6
+ metadata.gz: 8bde0d8539b2a44882f630eebaf6268480b920dbe61c3c5c7db015c6a96a7926b2561fe0bba769f0ae8cc326aecd3306b4ada335ddae3db3ad8a91f9cd4372e7
7
+ data.tar.gz: 8c13f71c579346723a8adc67e08f6acef330d0dc948109d05cf1fe469641a4460f7fb160178e08285963beeb336f657aa72731a7cda546a141d1c06c9f5e4c3f
data/README.md CHANGED
@@ -2,11 +2,13 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/timeouter.svg)](https://rubygems.org/gems/timeouter)
4
4
  [![Gem](https://img.shields.io/gem/dt/timeouter.svg)](https://rubygems.org/gems/timeouter/versions)
5
- [![Test Coverage](https://api.codeclimate.com/v1/badges/4b54466f8f384e3280d8/test_coverage)](https://codeclimate.com/github/RnD-Soft/timeouter/test_coverage)
6
- [![Maintainability](https://api.codeclimate.com/v1/badges/4b54466f8f384e3280d8/maintainability)](https://codeclimate.com/github/RnD-Soft/timeouter/maintainability)
7
- [![Quality](https://lysander.x.rnds.pro/api/v1/badges/timeouter_quality.svg)](https://lysander.x.rnds.pro/api/v1/badges/timeouter_quality.html)
8
- [![Outdated](https://lysander.x.rnds.pro/api/v1/badges/timeouter_outdated.svg)](https://lysander.x.rnds.pro/api/v1/badges/timeouter_outdated.html)
9
- [![Vulnerabilities](https://lysander.x.rnds.pro/api/v1/badges/timeouter_vulnerable.svg)](https://lysander.x.rnds.pro/api/v1/badges/timeouter_vulnerable.html)
5
+ [![YARD](https://badgen.net/badge/YARD/doc/blue)](http://www.rubydoc.info/gems/timeouter)
6
+
7
+ [![Coverage](https://lysander.rnds.pro/api/v1/badges/timeouter_coverage.svg)](https://lysander.rnds.pro/api/v1/badges/timeouter_coverage.html)
8
+ [![Quality](https://lysander.rnds.pro/api/v1/badges/timeouter_quality.svg)](https://lysander.rnds.pro/api/v1/badges/timeouter_quality.html)
9
+ [![Outdated](https://lysander.rnds.pro/api/v1/badges/timeouter_outdated.svg)](https://lysander.rnds.pro/api/v1/badges/timeouter_outdated.html)
10
+ [![Vulnerabilities](https://lysander.rnds.pro/api/v1/badges/timeouter_vulnerable.svg)](https://lysander.rnds.pro/api/v1/badges/timeouter_vulnerable.html)
11
+
10
12
 
11
13
  Timeouter is advisory timeout helper without any background threads.
12
14
 
@@ -21,7 +23,7 @@ Timeouter::run(3) do |t|
21
23
  sleep 1 # do some work
22
24
 
23
25
  puts t.elapsed # 1.00011811
24
- puts t.left # 3.99985717 or nil if timeout was 0
26
+ puts t.left # 1.99985717 or nil if timeout was 0
25
27
  puts t.exhausted? # false or nil if timeout was 0
26
28
  puts t.running? # true
27
29
  puts t.running! # true
@@ -13,12 +13,12 @@ module Timeouter
13
13
  @eclass = eclass || Timeouter::TimeoutError
14
14
  @message = message || 'execution expired'
15
15
 
16
- @started_at = Time.now
16
+ @started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC)
17
17
  end
18
18
 
19
19
  # elapsed time from creation
20
20
  def elapsed
21
- Time.now - @started_at
21
+ Process.clock_gettime(Process::CLOCK_MONOTONIC) - @started_at
22
22
  end
23
23
 
24
24
  # time left to be exhausted or nil if timeout was 0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timeouter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2.16523
4
+ version: 0.1.2.38793
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samoilenko Yuri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-23 00:00:00.000000000 Z
11
+ date: 2020-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler