Class: LIBUSB::Call::Timeval

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/libusb/call.rb

Instance Method Summary collapse

Instance Method Details

#in_msFixnum

get the number of milliseconds in timeval

Returns:

  • (Fixnum)


600
601
602
# File 'lib/libusb/call.rb', line 600

def in_ms
  self[:tv_sec]*1000 + self[:tv_usec]/1000
end

#in_ms=(value) ⇒ Object

set timeval to the number of milliseconds

Parameters:

  • value (Fixnum)


594
595
596
# File 'lib/libusb/call.rb', line 594

def in_ms=(value)
  self[:tv_sec], self[:tv_usec] = (value*1000).divmod(1000000)
end

#in_sFloat

get the number of seconds in timeval

Returns:

  • (Float)


612
613
614
# File 'lib/libusb/call.rb', line 612

def in_s
  self[:tv_sec] + self[:tv_usec]/1000000.0
end

#in_s=(value) ⇒ Object

set timeval to the number of seconds

Parameters:

  • value (Numeric)


606
607
608
# File 'lib/libusb/call.rb', line 606

def in_s=(value)
  self[:tv_sec], self[:tv_usec] = (value*1000000).divmod(1000000)
end