← Back to team overview

kicad-developers team mailing list archive

Re: Python: time_t needs mapping; tentative patch

 

Henner,

I'm pretty sure this is not correct because time_t is not long on all
platforms.  You should be able to include the header file where time_t
is defined and it should get mapped correctly.  If I am wrong, would one
of our resident swig experts chime in here.

Cheers,

Wayne

On 11/27/2017 9:20 AM, Henner Zeller wrote:
> Hi,
> whlie accessing SetTimeStamp() in the Python API, I found that the
> parameter type was not understood by the swig-bound code as integer
> type. So these functions can not be used out of
> the box with resulting error messages such as the following:
> 
>   File "/usr/local/lib/python2.7/dist-packages/pcbnew.py", line 1257,
> in SetTimeStamp
>    return _pcbnew.EDA_ITEM_SetTimeStamp(self, aNewTimeStamp)
> TypeError: in method 'EDA_ITEM_SetTimeStamp', argument 2 of type 'time_t'
> 
> The following will make it work, but I have no idea if this is the
> "correct" way to do this with swig, or if there should be a %typemap
> version of it. So I leave this here for someone knowledgeable in swig
> bindings to do it properly:
> 
> -------------------------------------8<----------------
> --- a/pcbnew/swig/typeinfo.i
> +++ b/pcbnew/swig/typeinfo.i
> @@ -29,6 +29,9 @@
> #include <core/typeinfo.h>
> %}
> 
> +// Set/GetTimeStamp() uses time_t
> +typedef long time_t;
> +
> // methods like CONNECTIVITY_DATA::GetNetItems take an array of KICAD_T values,
> ------------------------>8-------------------------------
> 
> Thanks,
>   Henner.
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 


Follow ups

References