cvs: /php3/functions basic_functions.c datetime.h datetime.c /php3 ChangeLog
| From: | sklar | Date: | Mon, 12 Jul 1999 15:21:25 +0000 |
| Subject: | cvs: /php3/functions basic_functions.c datetime.h datetime.c /php3 ChangeLog | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-8408@lists.php.net to get a copy of this message | ||
sklar Mon Jul 12 15:21:25 1999 EDT
Modified files:
/php3/functions basic_functions.c datetime.h datetime.c
/php3 ChangeLog
Log:
Added gmstrftime(), also added check to include <sys/time.h> at top of
datetime.c so that the struct timeval in php3_strtotime() would make it
past gcc.
Index: php3/functions/basic_functions.c
diff -u php3/functions/basic_functions.c:1.273 php3/functions/basic_functions.c:1.274
--- php3/functions/basic_functions.c:1.273 Mon Jul 12 11:56:30 1999
+++ php3/functions/basic_functions.c Mon Jul 12 15:21:25 1999
@@ -28,7 +28,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.273 1999/07/12 15:56:30 andrey Exp $ */
+/* $Id: basic_functions.c,v 1.274 1999/07/12 19:21:25 sklar Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
@@ -131,6 +131,7 @@
{"gmmktime", php3_gmmktime, NULL},
#if HAVE_STRFTIME
{"strftime", php3_strftime, NULL},
+ {"gmstrftime", php3_gmstrftime, NULL},
#endif
{"date", php3_date, NULL},
{"gmdate", php3_gmdate, NULL},
Index: php3/functions/datetime.h
diff -u php3/functions/datetime.h:1.15 php3/functions/datetime.h:1.16
--- php3/functions/datetime.h:1.15 Mon Jul 12 11:56:30 1999
+++ php3/functions/datetime.h Mon Jul 12 15:21:25 1999
@@ -29,7 +29,7 @@
*/
-/* $Id: datetime.h,v 1.15 1999/07/12 15:56:30 andrey Exp $ */
+/* $Id: datetime.h,v 1.16 1999/07/12 19:21:25 sklar Exp $ */
#ifndef _DATETIME_H
#define _DATETIME_H
@@ -43,6 +43,7 @@
extern void php3_checkdate(INTERNAL_FUNCTION_PARAMETERS);
#if HAVE_STRFTIME
extern void php3_strftime(INTERNAL_FUNCTION_PARAMETERS);
+extern void php3_gmstrftime(INTERNAL_FUNCTION_PARAMETERS);
#endif
extern void php3_strtotime(INTERNAL_FUNCTION_PARAMETERS);
Index: php3/functions/datetime.c
diff -u php3/functions/datetime.c:1.67 php3/functions/datetime.c:1.68
--- php3/functions/datetime.c:1.67 Mon Jul 12 11:56:30 1999
+++ php3/functions/datetime.c Mon Jul 12 15:21:25 1999
@@ -30,7 +30,7 @@
*/
-/* $Id: datetime.c,v 1.67 1999/07/12 15:56:30 andrey Exp $ */
+/* $Id: datetime.c,v 1.68 1999/07/12 19:21:25 sklar Exp $ */
#ifdef THREAD_SAFE
@@ -43,6 +43,9 @@
#include "snprintf.h"
#include <time.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
#include <stdio.h>
char *mon_full_names[] =
@@ -545,7 +548,7 @@
/* {{{ proto string strftime(string format[, int timestamp])
Format a local time/date according to locale settings */
-void php3_strftime(INTERNAL_FUNCTION_PARAMETERS)
+void _php3_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm)
{
pval *format_arg, *timestamp_arg;
char *format,*buf;
@@ -578,8 +581,11 @@
RETURN_FALSE;
}
format = format_arg->value.str.val;
- ta = localtime(×tamp);
-
+ if (gm) {
+ ta = gmtime(×tamp);
+ } else {
+ ta = localtime(×tamp);
+ }
buf = (char *) emalloc(buf_len);
while ((real_len=strftime(buf,buf_len,format,ta))==buf_len || real_len==0) {
buf_len *= 2;
@@ -593,6 +599,22 @@
}
efree(buf);
RETURN_FALSE;
+}
+/* }}} */
+
+/* {{{ proto string strftime(string format[, int timestamp])
+ Format a local time/date according to locale settings */
+void php3_strftime(INTERNAL_FUNCTION_PARAMETERS)
+{
+ _php3_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
+}
+/* }}} */
+
+/* {{{ proto string gmstrftime(string format[, int timestamp])
+ Format a GMT/CUT time/date according to locale settings */
+void php3_gmstrftime(INTERNAL_FUNCTION_PARAMETERS)
+{
+ _php3_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
#endif
Index: php3/ChangeLog
diff -u php3/ChangeLog:1.724 php3/ChangeLog:1.725
--- php3/ChangeLog:1.724 Mon Jul 12 15:13:45 1999
+++ php3/ChangeLog Mon Jul 12 15:21:25 1999
@@ -2,6 +2,8 @@
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
??, Version 3.0.12
+- added gmstrftime() (like strftime() but prints out in GMT not local
+ time) (David Sklar)
- A hack to allow 4bit antialiasing by modifying Freetype2 source (markonen)
- Initial Freetype2 support. You need to use the 1.2 compatibility
API <truetype.h> for now.. (markonen)