ztimer 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38850bb2a3a0ded109f65bb07c42af519d107e7c
4
- data.tar.gz: e714694fe0027efa7f6eb7fcbb4291fb4fb4604f
3
+ metadata.gz: 03ec6525946e2b8674a3f8401082b6eef8536130
4
+ data.tar.gz: 957b3894fc8259592b9ec4728727ae95bcdec284
5
5
  SHA512:
6
- metadata.gz: a76e6fb9268ff88ff2e57cc02ad5a7d909d8246a3fcf445d6f20f225f4d8cdbc8ea09eb1fefa6674de0ac7aa0d76b4c2185837b7afbb6732e40e9d318e8911e1
7
- data.tar.gz: 73ee9e7debf87eed17407cc45dce628ec5dc0e8bfca3d0b6b1b11fb465f51ffad3e25a1356737f26433eb76773d064c95b2a5533b805382fd02efa92ad95b00a
6
+ metadata.gz: a2f31354371be81f9d5f507f7ca955fdca10b5156d2da1a6583925a562488f50679f3df148282fd5c2d9af56b39c9ddc9a400e5933140f5e47b6fda1de8d3b71
7
+ data.tar.gz: 0811e83c8d916e4c7a47656a54263b6bda5407d7e01c07265cf099607ac52af4f03faf01727fa4ae3f0566fb840b2cff6210e6996e98a20731f58bfaeaa49a42
data/lib/ztimer/slot.rb CHANGED
@@ -1,10 +1,11 @@
1
1
 
2
2
  module Ztimer
3
3
  class Slot
4
- attr_reader :expires_at, :callback
4
+ attr_reader :enqueued_at, :expires_at, :callback
5
5
  attr_accessor :started_at, :executed_at
6
6
 
7
- def initialize(expires_at, &callback)
7
+ def initialize(enqueued_at, expires_at, &callback)
8
+ @enqueued_at = enqueued_at
8
9
  @expires_at = expires_at
9
10
  @callback = callback
10
11
  @started_at = nil
@@ -1,3 +1,3 @@
1
1
  module Ztimer
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/ztimer.rb CHANGED
@@ -17,8 +17,9 @@ module Ztimer
17
17
  attr_reader :concurrency, :running
18
18
 
19
19
  def after(milliseconds, &callback)
20
- expires_at = @metric.utc_microseconds + milliseconds * 1000
21
- slot = Slot.new(expires_at, &callback)
20
+ enqueued_at = @metric.utc_microseconds
21
+ expires_at = enqueued_at + milliseconds * 1000
22
+ slot = Slot.new(enqueued_at, expires_at, &callback)
22
23
  add(slot)
23
24
 
24
25
  return slot
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ztimer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Groza Sergiu