summaryrefslogtreecommitdiff
path: root/Examples/ocaml/strings_test/example.h
diff options
context:
space:
mode:
authorDerrick <a11426@users.sourceforge.net>2011-02-14 20:11:58 +0000
committerDerrick <a11426@users.sourceforge.net>2011-02-14 20:11:58 +0000
commit5815f7ec289e067e765fb8e893a2f337d8b48303 (patch)
treeebe9e0534a089fe431cedc6fdbc1a53ac523d70c /Examples/ocaml/strings_test/example.h
parent3e1af1f698d5d02d7905431bcb3549c0f7bc9aa7 (diff)
parent1fab53b2046b97702e1de4cfab06cb8fa8fc129d (diff)
downloadswig-a11426-fortran.tar.gz
update fortran branch. merge of 12160:12460a11426-fortran
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/a11426-fortran@12461 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Examples/ocaml/strings_test/example.h')
-rw-r--r--Examples/ocaml/strings_test/example.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/Examples/ocaml/strings_test/example.h b/Examples/ocaml/strings_test/example.h
index 3417981f0..959404b5d 100644
--- a/Examples/ocaml/strings_test/example.h
+++ b/Examples/ocaml/strings_test/example.h
@@ -1,14 +1,18 @@
/* -*- mode: c++ -*- */
/* File : example.h -- Tests all string typemaps */
+#include <sys/time.h>
+#include <time.h>
+
void takes_std_string( std::string in ) {
cout << "takes_std_string( \"" << in << "\" );" << endl;
}
std::string gives_std_string() {
- time_t t;
-
- return std::string( asctime( localtime( &t ) ) );
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+ return std::string( asctime( localtime( &tv.tv_sec ) ) );
}
void takes_char_ptr( char *p ) {
@@ -24,10 +28,10 @@ void takes_and_gives_std_string( std::string &inout ) {
inout.insert( inout.end(), ']' );
}
-void takes_and_gives_char_ptr( char *&ptr ) {
- char *pout = strchr( ptr, '.' );
- if( pout ) ptr = pout + 1;
- else ptr = "foo";
+void takes_and_gives_char_ptr( char *&inout ) {
+ char *pout = strchr( inout, '.' );
+ if( pout ) inout = pout + 1;
+ else inout = "foo";
}
/*