Class: LIBUSB::Call::Timeval
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- LIBUSB::Call::Timeval
- Defined in:
- lib/libusb/call.rb
Instance Method Summary collapse
-
#in_ms ⇒ Fixnum
get the number of milliseconds in timeval.
-
#in_ms=(value) ⇒ Object
set timeval to the number of milliseconds.
-
#in_s ⇒ Float
get the number of seconds in timeval.
-
#in_s=(value) ⇒ Object
set timeval to the number of seconds.
Instance Method Details
#in_ms ⇒ Fixnum
get the number of milliseconds in timeval
424 425 426 |
# File 'lib/libusb/call.rb', line 424 def in_ms self[:tv_sec]*1000 + self[:tv_usec]/1000 end |
#in_ms=(value) ⇒ Object
set timeval to the number of milliseconds
418 419 420 |
# File 'lib/libusb/call.rb', line 418 def in_ms=(value) self[:tv_sec], self[:tv_usec] = (value*1000).divmod(1000000) end |
#in_s ⇒ Float
get the number of seconds in timeval
436 437 438 |
# File 'lib/libusb/call.rb', line 436 def in_s self[:tv_sec] + self[:tv_usec]/1000000.0 end |
#in_s=(value) ⇒ Object
set timeval to the number of seconds
430 431 432 |
# File 'lib/libusb/call.rb', line 430 def in_s=(value) self[:tv_sec], self[:tv_usec] = (value*1000000).divmod(1000000) end |