Sha256: 46c95d873c035c28c3a964ed86d0cd29d5a61db89f37bed02956c158419eb12c

Contents?: true

Size: 534 Bytes

Versions: 103

Compression:

Stored size: 534 Bytes

Contents

require 'rubygems'
require 'ffi'
class Timeval < FFI::Struct
  rb_maj, rb_min, rb_micro = RUBY_VERSION.split('.')
  if rb_maj.to_i >= 1 && rb_min.to_i >= 9 || RUBY_PLATFORM =~ /java/
    layout :tv_sec => :ulong, :tv_usec => :ulong
  else
    layout :tv_sec, :ulong, 0, :tv_usec, :ulong, 4
  end
end
module LibC
  extend FFI::Library
  ffi_lib FFI::Library::LIBC
  attach_function :gettimeofday, [ :pointer, :pointer ], :int
end
t = Timeval.new
LibC.gettimeofday(t.pointer, nil)
puts "t.tv_sec=#{t[:tv_sec]} t.tv_usec=#{t[:tv_usec]}"

Version data entries

103 entries across 90 versions & 15 rubygems

Version Path
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/samples/gettimeofday.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.10.0/samples/gettimeofday.rb
approveapi-1.0.5 vendor/bundle/ruby/2.6.0/gems/ffi-1.10.0/samples/gettimeofday.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.25/samples/gettimeofday.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.25/samples/gettimeofday.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/samples/gettimeofday.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.10.0/samples/gettimeofday.rb
ffi-1.10.0-x64-mingw32 samples/gettimeofday.rb
ffi-1.10.0-x86-mingw32 samples/gettimeofday.rb
ffi-1.10.0 samples/gettimeofday.rb
tdiary-5.0.11 vendor/bundle/gems/ffi-1.9.25/samples/gettimeofday.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/samples/gettimeofday.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/samples/gettimeofday.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/samples/gettimeofday.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/samples/gettimeofday.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/samples/gettimeofday.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/samples/gettimeofday.rb
vagrant-unbundled-2.1.4.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/samples/gettimeofday.rb
vagrant-unbundled-2.1.2.0 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.25/samples/gettimeofday.rb
cloudsmith-api-0.30.7 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.25/samples/gettimeofday.rb