Skip to content

Commit

Permalink
Use auto-layout if running on ruby 1.9
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@7999 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information
vp-of-awesome committed Nov 4, 2008
1 parent 922fd0c commit 350ab0e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions samples/ffi/gettimeofday.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
require 'rubygems'
require 'ffi'
class Timeval < FFI::Struct
# layout :tv_sec => :ulong, :tv_usec => :ulong
layout :tv_sec, :ulong, 0, :tv_usec, :ulong, 4
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
Expand Down

0 comments on commit 350ab0e

Please sign in to comment.