io-event 1.6.2 → 1.6.4

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: 45049c22b990de175e733bdcce4045d7c4028dd50fa8018ec03b76ec76bfe1f2
4
- data.tar.gz: 250555adf9d939804cc19f050e8cc42d9f2848e90f75cbcf46abc6543a67dbf1
3
+ metadata.gz: 7e8079059cd981f3843b5887e4eb8b3059330ee939febdf21b2541011ec4a864
4
+ data.tar.gz: fd6c2d19dcd0a63b93a0f395faec3ac11933072f08a2a14de2546a6a402a2b09
5
5
  SHA512:
6
- metadata.gz: ed43ce7a15045fbad357e4e8b6eb176635ebd4148a2d3a5c229cc9af6c246f3d5bd0c8a80969f0a487fac468365b040888ef1e104275e0c82ef2397923bd24e3
7
- data.tar.gz: 7d36cf2bb3f8dbdddba94564057b767415ff8da2884c8810c2b88e5dae1162a5f17f7bc538a8f766e1be6c6fb14e0fd213f08182b8e8e29e1fea77292dc8f37d
6
+ metadata.gz: 887a130e38d3f4e2c514099aaeb8f34925e62b8ec4329d5c93df66db6d4bf277a5b3c3632db5e751b4974ada1b7f5ed99ed2d9cb5de56e26a0aa51bdca0f2e68
7
+ data.tar.gz: 1daa6130d762d3aa8c3df4771327e955813d7bcb18281cc155026dddbbceee5b4a08b52eac31134408e77768a9d7f4a4392b5d2fe8805bfb9353d4b1375f483e
checksums.yaml.gz.sig CHANGED
Binary file
@@ -786,24 +786,21 @@ struct timespec * make_timeout(VALUE duration, struct timespec * storage) {
786
786
  return NULL;
787
787
  }
788
788
 
789
- if (RB_FLOAT_TYPE_P(duration)) {
790
- double value = RFLOAT_VALUE(duration);
791
- time_t seconds = value;
792
-
793
- storage->tv_sec = seconds;
794
- storage->tv_nsec = (value - seconds) * 1000000000L;
795
-
796
- return storage;
797
- }
798
-
799
- else if (RB_INTEGER_TYPE_P(duration)) {
789
+ if (RB_INTEGER_TYPE_P(duration)) {
800
790
  storage->tv_sec = NUM2TIMET(duration);
801
791
  storage->tv_nsec = 0;
802
792
 
803
793
  return storage;
804
794
  }
805
795
 
806
- rb_raise(rb_eArgError, "unable to convert timeout: %"PRIsVALUE, rb_inspect(duration));
796
+ duration = rb_to_float(duration);
797
+ double value = RFLOAT_VALUE(duration);
798
+ time_t seconds = value;
799
+
800
+ storage->tv_sec = seconds;
801
+ storage->tv_nsec = (value - seconds) * 1000000000L;
802
+
803
+ return storage;
807
804
  }
808
805
 
809
806
  static
@@ -799,24 +799,21 @@ struct timespec * make_timeout(VALUE duration, struct timespec * storage) {
799
799
  return NULL;
800
800
  }
801
801
 
802
- if (RB_FLOAT_TYPE_P(duration)) {
803
- double value = RFLOAT_VALUE(duration);
804
- time_t seconds = value;
805
-
806
- storage->tv_sec = seconds;
807
- storage->tv_nsec = (value - seconds) * 1000000000L;
808
-
809
- return storage;
810
- }
811
-
812
- else if (RB_INTEGER_TYPE_P(duration)) {
802
+ if (RB_INTEGER_TYPE_P(duration)) {
813
803
  storage->tv_sec = NUM2TIMET(duration);
814
804
  storage->tv_nsec = 0;
815
805
 
816
806
  return storage;
817
807
  }
818
808
 
819
- rb_raise(rb_eArgError, "unable to convert timeout: %"PRIsVALUE, rb_inspect(duration));
809
+ duration = rb_to_float(duration);
810
+ double value = RFLOAT_VALUE(duration);
811
+ time_t seconds = value;
812
+
813
+ storage->tv_sec = seconds;
814
+ storage->tv_nsec = (value - seconds) * 1000000000L;
815
+
816
+ return storage;
820
817
  }
821
818
 
822
819
  static
@@ -901,24 +901,21 @@ struct __kernel_timespec * make_timeout(VALUE duration, struct __kernel_timespec
901
901
  return NULL;
902
902
  }
903
903
 
904
- if (RB_FLOAT_TYPE_P(duration)) {
905
- double value = RFLOAT_VALUE(duration);
906
- time_t seconds = value;
907
-
908
- storage->tv_sec = seconds;
909
- storage->tv_nsec = (value - seconds) * 1000000000L;
910
-
911
- return storage;
912
- }
913
-
914
- else if (RB_INTEGER_TYPE_P(duration)) {
904
+ if (RB_INTEGER_TYPE_P(duration)) {
915
905
  storage->tv_sec = NUM2TIMET(duration);
916
906
  storage->tv_nsec = 0;
917
907
 
918
908
  return storage;
919
909
  }
920
910
 
921
- rb_raise(rb_eArgError, "unable to convert timeout: %"PRIsVALUE, rb_inspect(duration));
911
+ duration = rb_to_float(duration);
912
+ double value = RFLOAT_VALUE(duration);
913
+ time_t seconds = value;
914
+
915
+ storage->tv_sec = seconds;
916
+ storage->tv_nsec = (value - seconds) * 1000000000L;
917
+
918
+ return storage;
922
919
  }
923
920
 
924
921
  static
@@ -420,8 +420,10 @@ module IO::Event
420
420
  duration = 0 unless @ready.empty?
421
421
  error = nil
422
422
 
423
- if duration && duration > 0.0
424
- start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
423
+ if duration
424
+ if duration > 0
425
+ start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
426
+ end
425
427
  else
426
428
  @idle_duration = 0.0
427
429
  end
@@ -50,18 +50,19 @@ class IO
50
50
  end
51
51
 
52
52
  # Schedule a block to be called at a specific time in the future.
53
- # @parameter time [Time] The time at which the block should be called, relative to {#now}.
53
+ # @parameter time [Float] The time at which the block should be called, relative to {#now}.
54
54
  def schedule(time, block)
55
55
  handle = Handle.new(time, block)
56
+
56
57
  @scheduled << handle
57
58
 
58
59
  return handle
59
60
  end
60
61
 
61
62
  # Schedule a block to be called after a specific time offset, relative to the current time as returned by {#now}.
62
- # @parameter offset [Time] The time offset from the current time at which the block should be called.
63
+ # @parameter offset [#to_f] The time offset from the current time at which the block should be called.
63
64
  def after(offset, &block)
64
- schedule(self.now + offset, block)
65
+ schedule(self.now + offset.to_f, block)
65
66
  end
66
67
 
67
68
  def wait_interval(now = self.now)
@@ -5,6 +5,6 @@
5
5
 
6
6
  class IO
7
7
  module Event
8
- VERSION = "1.6.2"
8
+ VERSION = "1.6.4"
9
9
  end
10
10
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: io-event
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -44,7 +44,7 @@ cert_chain:
44
44
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
45
45
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
46
46
  -----END CERTIFICATE-----
47
- date: 2024-06-12 00:00:00.000000000 Z
47
+ date: 2024-06-13 00:00:00.000000000 Z
48
48
  dependencies: []
49
49
  description:
50
50
  email:
metadata.gz.sig CHANGED
Binary file