Patch #1646728: datetime.fromtimestamp fails with negative
fractional times.  With unittest.

Somebody please backport to 2.5.
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index cf8a68b..7487c50 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -3683,6 +3683,12 @@
 		return NULL;
 	fraction = timestamp - (double)timet;
 	us = (int)round_to_long(fraction * 1e6);
+	if (us < 0) {
+		/* Truncation towards zero is not what we wanted
+		   for negative numbers (Python's mod semantics) */
+		timet -= 1;
+		us += 1000000;
+	}
 	/* If timestamp is less than one microsecond smaller than a
 	 * full second, round up. Otherwise, ValueErrors are raised
 	 * for some floats. */