Sha256: 864a5b7cb6eaaf71104896fd2a53476bcf208d5867437b3624ee2547e5792bb1
Contents?: true
Size: 367 Bytes
Versions: 2
Compression:
Stored size: 367 Bytes
Contents
require 'rubygems' require 'ffi' class Timeval < FFI::Struct # layout :tv_sec => :ulong, :tv_usec => :ulong layout :tv_sec, :ulong, 0, :tv_usec, :ulong, 4 end module LibC extend FFI::Library 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ffi-0.1.1 | samples/gettimeofday.rb |
ffi-0.1.0 | samples/gettimeofday.rb |