[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[minion-cvs] Resolve python time_t issue



Update of /home/minion/cvsroot/src/minion/src
In directory moria.seul.org:/tmp/cvs-serv28943/src

Modified Files:
	crypt.c 
Log Message:
Resolve python time_t issue

Index: crypt.c
===================================================================
RCS file: /home/minion/cvsroot/src/minion/src/crypt.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- crypt.c	19 Aug 2002 20:27:02 -0000	1.11
+++ crypt.c	21 Aug 2002 15:54:48 -0000	1.12
@@ -887,11 +887,14 @@
 				  "start_time", "end_time", NULL };
 	char *filename, *cn;
 	PyObject *_rsa;
-	/* XXXX Python wants to write into longs.  C wants time_t.  We should
-	 * XXXX check somewhere to be sure that we can cast long to time_t
-	 * XXXX without ill effects.
+
+	/*
+	 * Python wants time to be a double. OpenSSL wants time_t.
+	 * Ordinarily, I'd worry about resolution and bounds, but if time_t
+	 * doesn't fit in a double, Python's time.time() function is already
+	 * doomed.  
 	 */
-	long start_time, end_time;
+	double start_time, end_time;
 	
 	RSA *rsa = NULL;
 	EVP_PKEY *pkey = NULL;
@@ -902,7 +905,7 @@
 	PyObject *retval;
 	time_t time;
 	
-	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO!sll:generate_cert",
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO!sdd:generate_cert",
 					 kwlist, &filename,
 					 &mm_RSA_Type, &_rsa, &cn, 
 					 &start_time, &end_time))