summaryrefslogtreecommitdiff
path: root/ext/standard/datetime.c
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2005-07-03 19:14:55 +0000
committerDerick Rethans <derick@php.net>2005-07-03 19:14:55 +0000
commit0ef991e5ae409ecddedc6cfbb8231236ef84b936 (patch)
treefcbc18aa1afea8ab62816b308ffd8e6b1efb3afd /ext/standard/datetime.c
parentdda7692c87fed5131658772cc2c2ad6802d905cc (diff)
downloadphp-git-0ef991e5ae409ecddedc6cfbb8231236ef84b936.tar.gz
- Fixed bug #33532 (Different output for strftime() and date()).
- Re-implemented checkdate(), strftime() and gmstrftime() with the new timelib code.
Diffstat (limited to 'ext/standard/datetime.c')
-rw-r--r--ext/standard/datetime.c99
1 files changed, 0 insertions, 99 deletions
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
index 5e1933f5e9..8a2ceecf17 100644
--- a/ext/standard/datetime.c
+++ b/ext/standard/datetime.c
@@ -353,105 +353,6 @@ PHPAPI char *php_std_date(time_t t TSRMLS_DC)
}
/* }}} */
-/* {{{ proto bool checkdate(int month, int day, int year)
- Returns true(1) if it is a valid date in gregorian calendar */
-PHP_FUNCTION(checkdate)
-{
- long m, d, y;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &m, &d, &y) == FAILURE) {
- RETURN_FALSE;
- }
-
- if (y < 1 || y > 32767 || m < 1 || m > 12 || d < 1 || d > phpday_tab[isleap(y)][m - 1]) {
- RETURN_FALSE;
- }
- RETURN_TRUE; /* True : This month, day, year arguments are valid */
-}
-/* }}} */
-
-#if HAVE_STRFTIME
-/* {{{ _php_strftime
- */
-PHPAPI void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm)
-{
- pval **format_arg, **timestamp_arg;
- char *format, *buf;
- time_t timestamp;
- struct tm *ta, tmbuf;
- int max_reallocs = 5;
- size_t buf_len=64, real_len;
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &format_arg)==FAILURE) {
- RETURN_FALSE;
- }
- time(&timestamp);
- break;
- case 2:
- if (zend_get_parameters_ex(2, &format_arg, &timestamp_arg)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(timestamp_arg);
- timestamp = Z_LVAL_PP(timestamp_arg);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string_ex(format_arg);
- if (Z_STRLEN_PP(format_arg)==0) {
- RETURN_FALSE;
- }
-#ifdef PHP_WIN32
- if (timestamp < 0) {
- RETURN_FALSE;
- }
-#endif
- format = Z_STRVAL_PP(format_arg);
- if (gm) {
- ta = php_gmtime_r(&timestamp, &tmbuf);
- } else {
- ta = php_localtime_r(&timestamp, &tmbuf);
- }
-
- buf = (char *) emalloc(buf_len);
- while ((real_len=strftime(buf, buf_len, format, ta))==buf_len || real_len==0) {
- buf_len *= 2;
- buf = (char *) erealloc(buf, buf_len);
- if (!--max_reallocs) {
- break;
- }
- }
-
- if (real_len && real_len != buf_len) {
- buf = (char *) erealloc(buf, real_len + 1);
- RETURN_STRINGL(buf, real_len, 0);
- }
- efree(buf);
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string strftime(string format [, int timestamp])
- Format a local time/date according to locale settings */
-PHP_FUNCTION(strftime)
-{
- _php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string gmstrftime(string format [, int timestamp])
- Format a GMT/UCT time/date according to locale settings */
-PHP_FUNCTION(gmstrftime)
-{
- _php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-#endif
#if HAVE_STRPTIME
/* {{{ proto string strptime(string timestamp, string format)