cvs: /php3 ChangeLog php.h /php3/functions datetime.c
| From: | Rasmus Lerdorf | Date: | Wed, 28 Jul 1999 16:54:54 +0000 |
| Subject: | cvs: /php3 ChangeLog php.h /php3/functions datetime.c | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-9276@lists.php.net to get a copy of this message | ||
rasmus Wed Jul 28 12:54:54 1999 EDT
Modified files:
/php3 ChangeLog php.h
/php3/functions datetime.c
Log:
gmmktime/mktime DST fix
Index: php3/ChangeLog
diff -u php3/ChangeLog:1.733 php3/ChangeLog:1.734
--- php3/ChangeLog:1.733 Mon Jul 26 11:39:29 1999
+++ php3/ChangeLog Wed Jul 28 12:54:53 1999
@@ -1,7 +1,8 @@
PHP 3.0 CHANGE LOG ChangeLog
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-July 27, 1999, Version 3.0.12
+July 28, 1999, Version 3.0.12
+- gmktime/mktime DST fix (RL and Jim)
- Add imap_search (Chuck Hagenbuch)
- Added locale support for Perl Compatible Regexp functions (Andrey)
- fix crash on invalid URLs in fopen wrappers (Sascha)
Index: php3/php.h
diff -u php3/php.h:1.61 php3/php.h:1.62
--- php3/php.h:1.61 Thu Jul 8 09:25:55 1999
+++ php3/php.h Wed Jul 28 12:54:53 1999
@@ -28,7 +28,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php.h,v 1.61 1999/07/08 13:25:55 thies Exp $ */
+/* $Id: php.h,v 1.62 1999/07/28 16:54:53 rasmus Exp $ */
#ifndef _PHP_H
#define _PHP_H
@@ -149,7 +149,7 @@
#ifdef HAVE_FEATURES_H
#undef _GNU_SOURCE
-#define _GNU_SOURCE
+#define _GNU_SOURCE 1
#include <features.h>
#endif
Index: php3/functions/datetime.c
diff -u php3/functions/datetime.c:1.70 php3/functions/datetime.c:1.71
--- php3/functions/datetime.c:1.70 Fri Jul 16 14:05:00 1999
+++ php3/functions/datetime.c Wed Jul 28 12:54:53 1999
@@ -30,7 +30,7 @@
*/
-/* $Id: datetime.c,v 1.70 1999/07/16 18:05:00 jim Exp $ */
+/* $Id: datetime.c,v 1.71 1999/07/28 16:54:53 rasmus Exp $ */
#ifdef THREAD_SAFE
@@ -111,20 +111,37 @@
for (i = 0; i < arg_count; i++) {
convert_to_long(arguments[i]);
}
+
+ /* get the current time in seconds from epoch */
t=time(NULL);
#if HAVE_TZSET
tzset();
#endif
- tn = localtime(&t);
+
+ /* convert to a tm struct as local or gm time */
+ if (gm) {
+ tn = gmtime(&t);
+ }
+ else {
+ tn = localtime(&t);
+ }
memcpy(&ta,tn,sizeof(struct tm));
- if (gm)
+
+ /* if we're working in GMT, there's no DST, otherwise
+ we let the system figure it out */
+ if (gm) {
ta.tm_isdst = 0;
- else
+ }
+ else {
ta.tm_isdst = -1;
+ }
- if (arg_count > 6)
+ /* but the user can override that, of course */
+ if (arg_count > 6) {
ta.tm_isdst = arguments[6]->value.lval;
+ }
+ /* now we apply the specified parameters to the timestamp */
switch(arg_count) {
case 7:
case 6:
@@ -148,9 +165,8 @@
break;
}
- t=mktime(&ta); /* Need to do this because of Daylight savings */
- tn = localtime(&t);
-
+ /* if we're working in GMT, we need to fix the tm struct
+ to be in localtime before we can call mktime(). */
if (gm) {
#if HAVE_TM_GMTOFF
gmadjust=tn->tm_gmtoff;