diff options
Diffstat (limited to 'Examples/ocaml/strings_test/example.h')
-rw-r--r-- | Examples/ocaml/strings_test/example.h | 18 |
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"; } /* |