--- php-5.3.1/ext/date/php_date.c	2009-10-27 11:41:45.000000000 +0100
+++ active-3.1/ext/date/php_date.c	2009-12-02 16:07:36.000000000 +0100
@@ -774,7 +774,7 @@
  *   "All date-times in RSS conform to the Date and Time Specification of RFC 822,
  *   with the exception that the year may be expressed with two characters or four characters (four preferred)"
  */
-	REGISTER_STRING_CONSTANT("DATE_RSS",     DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
+	REGISTER_STRING_CONSTANT("DATE_RSS",     DATE_FORMAT_RFC822, CONST_CS | CONST_PERSISTENT);
 	REGISTER_STRING_CONSTANT("DATE_W3C",     DATE_FORMAT_RFC3339, CONST_CS | CONST_PERSISTENT);
 
 	REGISTER_LONG_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_CS | CONST_PERSISTENT);
@@ -874,7 +874,7 @@
 		time_t     the_time;
 		char      *tzid = NULL;
 		
-		the_time = time(NULL);
+		the_time = sapi_get_request_time(TSRMLS_C);
 		ta = php_localtime_r(&the_time, &tmbuf);
 		if (ta) {
 			tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, ta->tm_isdst);
@@ -1032,7 +1032,7 @@
 			offset->offset = (t->z) * -60;
 			offset->leap_secs = 0;
 			offset->is_dst = 0;
-			offset->abbr = malloc(9); /* GMT±xxxx\0 */
+			offset->abbr = malloc(9); /* GMT?xxxx\0 */
 			snprintf(offset->abbr, 9, "GMT%c%02d%02d", 
 			                          localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
 			                          localtime ? abs(offset->offset / 3600) : 0,
@@ -1172,7 +1172,7 @@
 		RETURN_FALSE;
 	}
 	if (ZEND_NUM_ARGS() == 1) {
-		ts = time(NULL);
+		ts = sapi_get_request_time(TSRMLS_C);
 	}
 
 	string = php_format_date(format, format_len, ts, localtime TSRMLS_CC);
@@ -1241,7 +1241,7 @@
 			offset->offset = (t->z - (t->dst * 60)) * -60;
 			offset->leap_secs = 0;
 			offset->is_dst = t->dst;
-			offset->abbr = malloc(9); /* GMT±xxxx\0 */
+			offset->abbr = malloc(9); /* GMT?xxxx\0 */
 			snprintf(offset->abbr, 9, "GMT%c%02d%02d", 
 			                          !localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
 			                          !localtime ? abs(offset->offset / 3600) : 0,
@@ -1338,7 +1338,7 @@
 	}
 
 	if (ZEND_NUM_ARGS() == 1) {
-		ts = time(NULL);
+		ts = sapi_get_request_time(TSRMLS_C);
 	}
 
 	ret = php_idate(format[0], ts, 0);
@@ -1413,7 +1413,7 @@
 		now = timelib_time_ctor();
 		now->tz_info = tzi;
 		now->zone_type = TIMELIB_ZONETYPE_ID;
-		timelib_unixtime2local(now, (timelib_sll) time(NULL));
+		timelib_unixtime2local(now, (timelib_sll) sapi_get_request_time(TSRMLS_C));
 	} else {
 		RETURN_FALSE;
 	}
@@ -1457,12 +1457,12 @@
 	/* Initialize structure with current time */
 	now = timelib_time_ctor();
 	if (gmt) {
-		timelib_unixtime2gmt(now, (timelib_sll) time(NULL));
+		timelib_unixtime2gmt(now, (timelib_sll) sapi_get_request_time(TSRMLS_C));
 	} else {
 		tzi = get_timezone_info(TSRMLS_C);
 		now->tz_info = tzi;
 		now->zone_type = TIMELIB_ZONETYPE_ID;
-		timelib_unixtime2local(now, (timelib_sll) time(NULL));
+		timelib_unixtime2local(now, (timelib_sll) sapi_get_request_time(TSRMLS_C));
 	}
 	/* Fill in the new data */
 	switch (ZEND_NUM_ARGS()) {
@@ -1582,7 +1582,7 @@
 	timelib_tzinfo      *tzi;
 	timelib_time_offset *offset = NULL;
 
-	timestamp = (long) time(NULL);
+	timestamp = (long) sapi_get_request_time(TSRMLS_C);
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &timestamp) == FAILURE) {
 		RETURN_FALSE;
@@ -1674,7 +1674,7 @@
    Return current UNIX timestamp */
 PHP_FUNCTION(time)
 {
-	RETURN_LONG((long)time(NULL));
+	RETURN_LONG((long)sapi_get_request_time(TSRMLS_C));
 }
 /* }}} */
 
@@ -1682,7 +1682,7 @@
    Returns the results of the C system call localtime as an associative array if the associative_array argument is set to 1 other wise it is a regular array */
 PHP_FUNCTION(localtime)
 {
-	long timestamp = (long)time(NULL);
+	long timestamp = (long)sapi_get_request_time(TSRMLS_C);
 	zend_bool associative = 0;
 	timelib_tzinfo *tzi;
 	timelib_time   *ts;
@@ -1729,7 +1729,7 @@
    Get date/time information */
 PHP_FUNCTION(getdate)
 {
-	long timestamp = (long)time(NULL);
+	long timestamp = (long)sapi_get_request_time(TSRMLS_C);
 	timelib_tzinfo *tzi;
 	timelib_time   *ts;
 
@@ -1954,7 +1954,7 @@
 	REGISTER_DATE_CLASS_CONST_STRING("RFC1123", DATE_FORMAT_RFC1123);
 	REGISTER_DATE_CLASS_CONST_STRING("RFC2822", DATE_FORMAT_RFC2822);
 	REGISTER_DATE_CLASS_CONST_STRING("RFC3339", DATE_FORMAT_RFC3339);
-	REGISTER_DATE_CLASS_CONST_STRING("RSS",     DATE_FORMAT_RFC1123);
+	REGISTER_DATE_CLASS_CONST_STRING("RSS",     DATE_FORMAT_RFC822);
 	REGISTER_DATE_CLASS_CONST_STRING("W3C",     DATE_FORMAT_RFC3339);
 
 
@@ -2427,7 +2427,7 @@
 			now->tz_abbr = new_abbr;
 			break;
 	}
-	timelib_unixtime2local(now, (timelib_sll) time(NULL));
+	timelib_unixtime2local(now, (timelib_sll) sapi_get_request_time(TSRMLS_C));
 
 	timelib_fill_holes(dateobj->time, now, TIMELIB_NO_CLONE);
 	timelib_update_ts(dateobj->time, tzi);
