svn commit: samba r3474 - in branches/SAMBA_4_0/source/scripting/swig: .

tpot at samba.org tpot at samba.org
Tue Nov 2 11:06:00 GMT 2004


Author: tpot
Date: 2004-11-02 11:06:00 +0000 (Tue, 02 Nov 2004)
New Revision: 3474

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3474

Log:
Add conversion functions for the time_t type.

Modified:
   branches/SAMBA_4_0/source/scripting/swig/dcerpc.i


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/swig/dcerpc.i
===================================================================
--- branches/SAMBA_4_0/source/scripting/swig/dcerpc.i	2004-11-02 11:05:25 UTC (rev 3473)
+++ branches/SAMBA_4_0/source/scripting/swig/dcerpc.i	2004-11-02 11:06:00 UTC (rev 3474)
@@ -197,6 +197,29 @@
 	return PyLong_FromUnsignedLongLong(obj);
 }
 
+time_t time_t_from_python(PyObject *obj, char *name)
+{
+	if (obj == NULL) {
+		PyErr_Format(PyExc_ValueError, "Expecting key %s", name);
+		return 0;
+	}
+
+	if (!PyLong_Check(obj) && !PyInt_Check(obj)) {
+		PyErr_Format(PyExc_TypeError, "Expecting int or long value for %s", name);
+		return 0;
+	}
+
+	if (PyLong_Check(obj))
+		return (time_t)PyLong_AsUnsignedLongLong(obj);
+	else
+		return (time_t)PyInt_AsUnsignedLongMask(obj);
+}
+
+PyObject *time_t_to_python(time_t obj)
+{
+	return PyLong_FromUnsignedLongLong(obj);
+}
+
 HYPER_T HYPER_T_from_python(PyObject *obj, char *name)
 {
 	if (obj == NULL) {



More information about the samba-cvs mailing list