patch #3176274 - Ruby typecheck typemap for time_t.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12459 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2011-02-13 22:19:46 +00:00
commit 7d700cc999
2 changed files with 8 additions and 0 deletions

View file

@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 2.0.2 (in progress)
===========================
2011-02-13: wsfulton
[Ruby] Apply patch #3176274 from James Masters - typecheck typemap for time_t.
2011-02-13: wsfulton
Apply patch #3171793 from szager - protected director methods failing when -fvirtual is used.

View file

@ -58,6 +58,11 @@ struct timeval rb_time_timeval(VALUE);
$1 = NUM2LONG(rb_funcall($input, rb_intern("tv_sec"), 0));
}
%typemap(typecheck) time_t
{
$1 = (NIL_P($input) || TYPE(rb_funcall($input, rb_intern("respond_to?"), 1, ID2SYM(rb_intern("tv_sec")))) == T_TRUE);
}
%typemap(out) time_t
{
$result = rb_time_new($1, 0);