please could you include something like this? written for PyDMagic - preinit is called before python initialization and postInit after. but same idea in pure pyd.
You might want to include handling second fractions properly and timezones for a systime. The below was enough for me for now.
please could you include something like this? written for PyDMagic - preinit is called before python initialization and postInit after. but same idea in pure pyd.
You might want to include handling second fractions properly and timezones for a systime. The below was enough for me for now.
void preInit() { import pyd.pyd; import deimos.python.datetime; import std.datetime; ex_d_to_python((DateTime dt) => PyDateTime_FromDateAndTime( dt.year.to!int,dt.month.to!int,dt.day.to!int,dt.hour.to!int,dt.minute.to!int,dt.second.to!int,0)); }
void postInit() { import pyd.pyd; import deimos.python.datetime; PyDateTime_IMPORT(); }