Quantcast

Handling time in SWIG

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Handling time in SWIG

Jake
Is there a preferred way for handling date-times in SWIG?  Given this example:


It seems implied that we need to write our own marshalling typemaps for each target language with respect to the C++ type we use.  But since there are a couple of built-in types that represent times already, I'm wondering if there is support for any of these already (built in or third party), e.g. one of:

time_t (from <ctime>)
std::chrono::system_clock::time_point (from <chrono> in C++11)

-Jake Cobb

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Handling time in SWIG

William S Fulton


On 3 April 2017 at 15:21, Jake <[hidden email]> wrote:
Is there a preferred way for handling date-times in SWIG?  Given this example:


It seems implied that we need to write our own marshalling typemaps for each target language with respect to the C++ type we use.  But since there are a couple of built-in types that represent times already, I'm wondering if there is support for any of these already (built in or third party), e.g. one of:

time_t (from <ctime>)
std::chrono::system_clock::time_point (from <chrono> in C++11)

SWIG provides library interface files for many of the C/C++ library headers, eg std_vector.i for <vector>. The coverage is far from complete and I don't see anything for C <time.h> nor C++11 <chrono>. If you or anyone else creates the appropriate typemaps, please contribute them back for inclusion in a future release. They'd need to go into library files named time.i and std_chrono.i. For Ruby, there is actually support for time_t in timeval.i.

William


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Loading...