percy-common 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0fe4132dddef08590d485a30d755fa43e95bc0cc4569b0f716e25c756c5dca5
4
- data.tar.gz: 9de9dbc2f26404e03f22175bfc742080df122824d9510197a23a0f55c8ca0c65
3
+ metadata.gz: 15a863191e2a3892bdc0e9083e3c652aa92de501f65f134b0213e760ca4f7573
4
+ data.tar.gz: b7b33dc5b49fd86048bc37c27ccc763b428065fcd5035a08307510c0e23af469
5
5
  SHA512:
6
- metadata.gz: 4063a9ab97a6a5e30774733dbe8922dc690b6556f80f6a3c28651043e050043ea5a76b4de1220a2e3f3fa0688968a259fe9eaba7a77f11699fb9a9e5348f68ab
7
- data.tar.gz: 89cb3605660c98e521e3f08c72be55b3517236ee3702dda10c65d09c35eaa855b5b6715d2e349359c34e8fdb41020139dce834e8a3acb2ff7457e0bfe4e6b641
6
+ metadata.gz: acc619521a157d94e02d5e1cc4d667b4e13970fd33245fb1f000109ff1629d72dd7db1a39d9eab08c49d0d22ef6373220a55d58b42a1ba727eb919b5a9f64de4
7
+ data.tar.gz: 4814087c1058fd032e6635fca5d21b0e8cf489701a3848615a998c4eb50f94966c814ecb2e480cbe7de4d7bc65c5d3f565cbb1c5a490cdb668a75412aa36648f
@@ -1,5 +1,5 @@
1
1
  module Percy
2
2
  module Common
3
- VERSION = '3.0.0'.freeze
3
+ VERSION = '3.0.1'.freeze
4
4
  end
5
5
  end
@@ -44,15 +44,31 @@ module Percy
44
44
  # Programmer mistake, so raise an error.
45
45
  raise 'no timing started' unless @_timing_start
46
46
 
47
- time_since(stat, @_timing_start, options)
47
+ time_since_monotonic(stat, @_timing_start, options)
48
48
  @_timing_start = nil
49
49
  true
50
50
  end
51
51
 
52
- def time_since(stat, start, opts = {})
52
+ # dogstatsd uses a monotonic (linearly increasing) clock to calculate time
53
+ # intervals, so this should be used where necessary. However, it's not
54
+ # possible to compare monotonic time values with fixed times, so both are
55
+ # available.
56
+ def time_since_monotonic(stat, start, opts = {})
57
+ unless start.instance_of? Float
58
+ raise ArgumentError, 'start value must be Float'
59
+ end
60
+
53
61
  timing(stat, ((now.to_f - start.to_f) * 1000).round, opts)
54
62
  end
55
63
 
64
+ def time_since(stat, start, opts = {})
65
+ unless start.instance_of? Time
66
+ raise ArgumentError, 'start value must be Time'
67
+ end
68
+
69
+ timing(stat, ((Time.now.to_f - start.to_f) * 1000).round, opts)
70
+ end
71
+
56
72
  private def now
57
73
  Process.clock_gettime(Process::CLOCK_MONOTONIC)
58
74
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.add_dependency 'excon', '~> 0.57'
21
21
 
22
22
  spec.add_development_dependency 'bundler', '~> 2.0.2'
23
- spec.add_development_dependency 'rake', '~> 10.0'
23
+ spec.add_development_dependency 'rake', '~> 12.3'
24
24
  spec.add_development_dependency 'rspec', '~> 3.2'
25
25
  spec.add_development_dependency 'guard-rspec', '~> 4.7'
26
26
  spec.add_development_dependency 'percy-style', '~> 0.6.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: percy-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Perceptual Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-16 00:00:00.000000000 Z
11
+ date: 2019-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dogstatsd-ruby
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '12.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '12.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement