cvs: php-src /ext/date php_date.c php_date.h

From: Date: Fri, 08 Jul 2005 12:26:31 +0000
Subject: cvs: php-src /ext/date php_date.c php_date.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-32803@lists.php.net to get a copy of this message
tony2001 Fri Jul 8 08:26:31 2005 EDT Modified files: /php-src/ext/date php_date.c php_date.h Log: rename php_format_date() to date_format() add wrapper for date_format() to use it in other extensions http://cvs.php.net/diff.php/php-src/ext/date/php_date.c?r1=1.36&r2=1.37&ty=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.36 php-src/ext/date/php_date.c:1.37 --- php-src/ext/date/php_date.c:1.36 Fri Jul 8 06:23:33 2005 +++ php-src/ext/date/php_date.c Fri Jul 8 08:26:30 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_date.c,v 1.36 2005/07/08 10:23:33 tony2001 Exp $ */ +/* $Id: php_date.c,v 1.37 2005/07/08 12:26:30 tony2001 Exp $ */ #include "php.h" #include "php_streams.h" @@ -233,8 +233,8 @@ } /* }}} */ -/* {{{ php_format_date - (gm)date helper */ -static char *php_format_date(char *format, int format_len, timelib_time *t, int localtime) +/* {{{ date_format - (gm)date helper */ +static char *date_format(char *format, int format_len, timelib_time *t, int localtime) { smart_str string = {0}; int i; @@ -341,14 +341,24 @@ char *format; int format_len; long ts = time(NULL); - timelib_time *t; char *string; - timelib_tzinfo *tzi; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) { RETURN_FALSE; } + string = php_format_date(format, format_len, ts, localtime); + + RETVAL_STRING(string, 0); +} +/* }}} */ + +PHPAPI char *php_format_date(char *format, int format_len, long ts, int localtime) /* {{{ */ +{ + timelib_time *t; + timelib_tzinfo *tzi; + char *string; + t = timelib_time_ctor(); if (localtime) { @@ -358,13 +368,15 @@ tzi = NULL; timelib_unixtime2gmt(t, ts); } - string = php_format_date(format, format_len, t, localtime); + + string = date_format(format, format_len, t, localtime); - RETVAL_STRING(string, 0); if (localtime) { timelib_tzinfo_dtor(tzi); } + timelib_time_dtor(t); + return string; } /* }}} */ http://cvs.php.net/diff.php/php-src/ext/date/php_date.h?r1=1.13&r2=1.14&ty=u Index: php-src/ext/date/php_date.h diff -u php-src/ext/date/php_date.h:1.13 php-src/ext/date/php_date.h:1.14 --- php-src/ext/date/php_date.h:1.13 Mon Jul 4 17:27:25 2005 +++ php-src/ext/date/php_date.h Fri Jul 8 08:26:30 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_date.h,v 1.13 2005/07/04 21:27:25 derick Exp $ */ +/* $Id: php_date.h,v 1.14 2005/07/08 12:26:30 tony2001 Exp $ */ #ifndef PHP_DATE_H #define PHP_DATE_H @@ -69,5 +69,6 @@ #define _php_strftime php_strftime PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm); #endif +PHPAPI char *php_format_date(char *format, int format_len, long ts, int localtime); #endif /* PHP_DATE_H */

« previous php.cvs (#32803) next »