Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
return 0;
}
-static PyObject* PyDateTime_FromTime_t(const time_t* t) {
- struct tm buffer;
-
- struct tm* tm = gmtime_r(t, &buffer);
- if (!tm)
- return NULL;
-
- PyDateTime_IMPORT;
-
- return PyDateTime_FromDateAndTime(
- 1900 + tm->tm_year,
- 1 + tm->tm_mon,
- tm->tm_mday,
- tm->tm_hour,
- tm->tm_min,
- tm->tm_sec,
- 0
- );
-}
-
static time_t PyDateTime_AsTime_t(PyObject* value) {
if (!PyDateTime_Check(value))
return -1;
#############################################################################*/
#include <Python.h>
+#include <datetime.h>
#include <errno.h>
#include <time.h>
Py_XDECREF(list);
return NULL;
}
+
+PyObject* PyDateTime_FromTime_t(const time_t* t) {
+ struct tm buffer;
+
+ struct tm* tm = gmtime_r(t, &buffer);
+ if (!tm)
+ return NULL;
+
+ PyDateTime_IMPORT;
+
+ return PyDateTime_FromDateAndTime(
+ 1900 + tm->tm_year,
+ 1 + tm->tm_mon,
+ tm->tm_mday,
+ tm->tm_hour,
+ tm->tm_min,
+ tm->tm_sec,
+ 0
+ );
+}
PyObject* PyList_FromPackageList(struct pakfire_packagelist* packagelist);
PyObject* PyList_FromFileList(struct pakfire_filelist* filelist);
+PyObject* PyDateTime_FromTime_t(const time_t* t);
+
#endif /* PYTHON_PAKFIRE_UTIL_H */