derick Thu Jun 16 13:12:42 2005 EDT
Added files:
/php-src/ext/date/lib timelib.c timelib.h
Removed files:
/php-src/ext/date/lib datetime.c datetime.h
Modified files:
/php-src/ext/date config.m4 config.w32 php_date.c
/php-src/ext/date/lib parse_date.c parse_tz.c tm2unixtime.c
unixtime2tm.c
/php-src/ext/date/lib/resource parse_date.re
Log:
- Rename "datetime.c" and "datetime.h" to "timelib.c" and "timelib.h" to
prevent duplicate header names.
http://cvs.php.net/diff.php/php-src/ext/date/config.m4?r1=1.2&r2=1.3&ty=u
Index: php-src/ext/date/config.m4
diff -u php-src/ext/date/config.m4:1.2 php-src/ext/date/config.m4:1.3
--- php-src/ext/date/config.m4:1.2 Tue Jun 14 18:50:55 2005
+++ php-src/ext/date/config.m4 Thu Jun 16 13:12:40 2005
@@ -1,5 +1,5 @@
-dnl $Id: config.m4,v 1.2 2005/06/14 22:50:55 sniper Exp $
+dnl $Id: config.m4,v 1.3 2005/06/16 17:12:40 derick Exp $
dnl config.m4 for date extension
-PHP_NEW_EXTENSION(date, php_date.c lib/datetime.c lib/dow.c lib/parse_date.c
lib/parse_tz.c lib/tm2unixtime.c lib/unixtime2tm.c)
+PHP_NEW_EXTENSION(date, php_date.c lib/timelib.c lib/dow.c lib/parse_date.c
lib/parse_tz.c lib/tm2unixtime.c lib/unixtime2tm.c)
PHP_ADD_BUILD_DIR([$ext_builddir/lib])
http://cvs.php.net/diff.php/php-src/ext/date/config.w32?r1=1.2&r2=1.3&ty=u
Index: php-src/ext/date/config.w32
diff -u php-src/ext/date/config.w32:1.2 php-src/ext/date/config.w32:1.3
--- php-src/ext/date/config.w32:1.2 Wed Jun 15 04:44:23 2005
+++ php-src/ext/date/config.w32 Thu Jun 16 13:12:40 2005
@@ -1,6 +1,6 @@
-// $Id: config.w32,v 1.2 2005/06/15 08:44:23 edink Exp $
+// $Id: config.w32,v 1.3 2005/06/16 17:12:40 derick Exp $
// vim:ft=javascript
EXTENSION("date", "php_date.c", false, "-Iext/date/lib");
-ADD_SOURCES("ext/date/lib", "datetime.c dow.c parse_date.c parse_tz.c
tm2unixtime.c unixtime2tm.c", "date");
+ADD_SOURCES("ext/date/lib", "timelib.c dow.c parse_date.c parse_tz.c
tm2unixtime.c unixtime2tm.c", "date");
AC_DEFINE('HAVE_DATE', 1, 'Have date/time support');
http://cvs.php.net/diff.php/php-src/ext/date/php_date.c?r1=1.7&r2=1.8&ty=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.7 php-src/ext/date/php_date.c:1.8
--- php-src/ext/date/php_date.c:1.7 Wed Jun 15 19:30:20 2005
+++ php-src/ext/date/php_date.c Thu Jun 16 13:12:41 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_date.c,v 1.7 2005/06/15 23:30:20 iliaa Exp $ */
+/* $Id: php_date.c,v 1.8 2005/06/16 17:12:41 derick Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -26,7 +26,7 @@
#include "ext/standard/info.h"
#include "php_date.h"
#include "lib/timelib_structs.h"
-#include "lib/datetime.h"
+#include "lib/timelib.h"
#include <time.h>
function_entry date_functions[] = {
http://cvs.php.net/diff.php/php-src/ext/date/lib/parse_date.c?r1=1.8&r2=1.9&ty=u
Index: php-src/ext/date/lib/parse_date.c
diff -u php-src/ext/date/lib/parse_date.c:1.8
php-src/ext/date/lib/parse_date.c:1.9
--- php-src/ext/date/lib/parse_date.c:1.8 Thu Jun 16 09:30:25 2005
+++ php-src/ext/date/lib/parse_date.c Thu Jun 16 13:12:41 2005
@@ -18,12 +18,12 @@
+----------------------------------------------------------------------+
*/
-/* $Id: parse_date.c,v 1.8 2005/06/16 13:30:25 derick Exp $ */
+/* $Id: parse_date.c,v 1.9 2005/06/16 17:12:41 derick Exp $ */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include "datetime.h"
+#include "timelib.h"
#if defined(_MSC_VER)
#define strcasecmp stricmp
http://cvs.php.net/diff.php/php-src/ext/date/lib/parse_tz.c?r1=1.4&r2=1.5&ty=u
Index: php-src/ext/date/lib/parse_tz.c
diff -u php-src/ext/date/lib/parse_tz.c:1.4 php-src/ext/date/lib/parse_tz.c:1.5
--- php-src/ext/date/lib/parse_tz.c:1.4 Wed Jun 15 07:01:04 2005
+++ php-src/ext/date/lib/parse_tz.c Thu Jun 16 13:12:41 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: parse_tz.c,v 1.4 2005/06/15 11:01:04 derick Exp $ */
+/* $Id: parse_tz.c,v 1.5 2005/06/16 17:12:41 derick Exp $ */
#include <stdio.h>
#ifdef WIN32
@@ -26,7 +26,7 @@
#endif
#include <string.h>
-#include "datetime.h"
+#include "timelib.h"
#include "timezonedb.h"
static void read_header(char **tzf, timelib_tzinfo *tz)
http://cvs.php.net/diff.php/php-src/ext/date/lib/tm2unixtime.c?r1=1.4&r2=1.5&ty=u
Index: php-src/ext/date/lib/tm2unixtime.c
diff -u php-src/ext/date/lib/tm2unixtime.c:1.4
php-src/ext/date/lib/tm2unixtime.c:1.5
--- php-src/ext/date/lib/tm2unixtime.c:1.4 Wed Jun 15 19:42:55 2005
+++ php-src/ext/date/lib/tm2unixtime.c Thu Jun 16 13:12:41 2005
@@ -16,9 +16,9 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tm2unixtime.c,v 1.4 2005/06/15 23:42:55 iliaa Exp $ */
+/* $Id: tm2unixtime.c,v 1.5 2005/06/16 17:12:41 derick Exp $ */
-#include "datetime.h"
+#include "timelib.h"
/* jan feb mrt apr may jun jul aug
sep oct nov dec */
static int month_tab_leap[12] = { -1, 30, 59, 90, 120, 151, 181, 212,
243, 273, 304, 334 };
http://cvs.php.net/diff.php/php-src/ext/date/lib/unixtime2tm.c?r1=1.3&r2=1.4&ty=u
Index: php-src/ext/date/lib/unixtime2tm.c
diff -u php-src/ext/date/lib/unixtime2tm.c:1.3
php-src/ext/date/lib/unixtime2tm.c:1.4
--- php-src/ext/date/lib/unixtime2tm.c:1.3 Wed Jun 15 05:02:28 2005
+++ php-src/ext/date/lib/unixtime2tm.c Thu Jun 16 13:12:41 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: unixtime2tm.c,v 1.3 2005/06/15 09:02:28 edink Exp $ */
+/* $Id: unixtime2tm.c,v 1.4 2005/06/16 17:12:41 derick Exp $ */
#include <stdlib.h>
#include <stdio.h>
@@ -28,7 +28,7 @@
#define TIMELIB_LL_CONST(n) n ## ll
#endif
-#include "datetime.h"
+#include "timelib.h"
static int month_tab_leap[12] = { -1, 30, 59, 90, 120, 151, 181, 212, 243,
273, 304, 334 };
static int month_tab[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273,
304, 334 };
http://cvs.php.net/diff.php/php-src/ext/date/lib/resource/parse_date.re?r1=1.7&r2=1.8&ty=u
Index: php-src/ext/date/lib/resource/parse_date.re
diff -u php-src/ext/date/lib/resource/parse_date.re:1.7
php-src/ext/date/lib/resource/parse_date.re:1.8
--- php-src/ext/date/lib/resource/parse_date.re:1.7 Thu Jun 16 09:30:26 2005
+++ php-src/ext/date/lib/resource/parse_date.re Thu Jun 16 13:12:41 2005
@@ -16,12 +16,12 @@
+----------------------------------------------------------------------+
*/
-/* $Id: parse_date.re,v 1.7 2005/06/16 13:30:26 derick Exp $ */
+/* $Id: parse_date.re,v 1.8 2005/06/16 17:12:41 derick Exp $ */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include "datetime.h"
+#include "timelib.h"
#if defined(_MSC_VER)
#define strcasecmp stricmp
http://cvs.php.net/co.php/php-src/ext/date/lib/timelib.c?r=1.1&p=1
Index: php-src/ext/date/lib/timelib.c
+++ php-src/ext/date/lib/timelib.c
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [EMAIL PROTECTED] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <[EMAIL PROTECTED]>
|
+----------------------------------------------------------------------+
*/
/* $Id: timelib.c,v 1.1 2005/06/16 17:12:41 derick Exp $ */
#include "timelib_structs.h"
#include "timelib.h"
#include <ctype.h>
#define TIMELIB_TIME_FREE(m) \
if (m) { \
free(m); \
m = NULL; \
} \
timelib_time* timelib_time_ctor()
{
timelib_time *t;
t = calloc(1, sizeof(timelib_time));
return t;
}
void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr)
{
unsigned int i;
TIMELIB_TIME_FREE(tm->tz_abbr);
tm->tz_abbr = strdup(tz_abbr);
for (i = 0; i < strlen(tz_abbr); i++) {
tm->tz_abbr[i] = toupper(tz_abbr[i]);
}
}
void timelib_time_dtor(timelib_time* t)
{
TIMELIB_TIME_FREE(t->tz_abbr);
if (t->tz_info) {
timelib_tzinfo_dtor(t->tz_info);
t->tz_info = NULL;
}
TIMELIB_TIME_FREE(t);
}
timelib_time_offset* timelib_time_offset_ctor()
{
timelib_time_offset *t;
t = calloc(1, sizeof(timelib_time_offset));
return t;
}
void timelib_time_offset_dtor(timelib_time_offset* t)
{
TIMELIB_TIME_FREE(t->abbr);
TIMELIB_TIME_FREE(t);
}
timelib_tzinfo* timelib_tzinfo_ctor(char *name)
{
timelib_tzinfo *t;
t = calloc(1, sizeof(timelib_tzinfo));
t->name = strdup(name);
return t;
}
timelib_tzinfo *timelib_tzinfo_clone(timelib_tzinfo *tz)
{
timelib_tzinfo *tmp = timelib_tzinfo_ctor(tz->name);
tmp->ttisgmtcnt = tz->ttisgmtcnt;
tmp->ttisstdcnt = tz->ttisstdcnt;
tmp->leapcnt = tz->leapcnt;
tmp->timecnt = tz->timecnt;
tmp->typecnt = tz->typecnt;
tmp->charcnt = tz->charcnt;
tmp->trans = (int32_t *) malloc(tz->timecnt * sizeof(int32_t));
tmp->trans_idx = (unsigned char*) malloc(tz->timecnt * sizeof(unsigned
char));
memcpy(tmp->trans, tz->trans, tz->timecnt * sizeof(int32_t));
memcpy(tmp->trans_idx, tz->trans_idx, tz->timecnt * sizeof(unsigned
char));
tmp->type = (ttinfo*) malloc(tz->typecnt * sizeof(struct ttinfo));
memcpy(tmp->type, tz->type, tz->typecnt * sizeof(struct ttinfo));
tmp->timezone_abbr = (char*) malloc(tz->charcnt);
memcpy(tmp->timezone_abbr, tz->timezone_abbr, tz->charcnt);
tmp->leap_times = (tlinfo*) malloc(tz->leapcnt * sizeof(tlinfo));
memcpy(tmp->leap_times, tz->leap_times, tz->leapcnt * sizeof(tlinfo));
return tmp;
}
void timelib_tzinfo_dtor(timelib_tzinfo *tz)
{
TIMELIB_TIME_FREE(tz->name);
TIMELIB_TIME_FREE(tz->trans);
TIMELIB_TIME_FREE(tz->trans_idx);
TIMELIB_TIME_FREE(tz->type);
TIMELIB_TIME_FREE(tz->timezone_abbr);
TIMELIB_TIME_FREE(tz->leap_times);
TIMELIB_TIME_FREE(tz);
}
char *timelib_get_tz_abbr_ptr(timelib_time *t)
{
if (!t->sse_uptodate) {
timelib_update_ts(t, NULL);
};
return t->tz_abbr;
}
signed long timelib_date_to_int(timelib_time *d, int *error)
{
timelib_sll ts;
ts = d->sse;
if (ts < LONG_MIN || ts > LONG_MAX) {
if (error) {
*error = 1;
}
return 0;
}
if (error) {
*error = 0;
}
return (signed long) d->sse;
}
void timelib_dump_date(timelib_time *d, int options)
{
if ((options & 2) == 2) {
printf("TYPE: %d ", d->zone_type);
}
printf("TS: %lld | %04lld-%02lld-%02lld %02lld:%02lld:%02lld",
d->sse, d->y, d->m, d->d, d->h, d->i, d->s);
if (d->f > +0.0) {
printf(" %.5f", d->f);
}
if (d->is_localtime) {
switch (d->zone_type) {
case TIMELIB_ZONETYPE_OFFSET: /* Only offset */
printf(" GMT %05d%s", d->z, d->dst == 1 ? "
(DST)" : "");
break;
case TIMELIB_ZONETYPE_ID: /* Timezone struct */
/* Show abbreviation if wanted */
if (d->tz_abbr) {
printf(" %s", d->tz_abbr);
}
/* Do we have a TimeZone struct? */
if (d->tz_info) {
printf(" %s", d->tz_info->name);
}
break;
case TIMELIB_ZONETYPE_ABBR:
printf(" %s", d->tz_abbr);
printf(" %05d%s", d->z, d->dst == 1 ? " (DST)"
: "");
break;
}
} else {
printf(" GMT 00000");
}
if ((options & 1) == 1) {
if (d->have_relative) {
printf("%3lldY %3lldM %3lldD / %3lldH %3lldM %3lldS",
d->relative.y, d->relative.m, d->relative.d,
d->relative.h, d->relative.i, d->relative.s);
}
if (d->have_weekday_relative) {
printf(" / %d", d->relative.weekday);
}
}
printf("\n");
}
http://cvs.php.net/co.php/php-src/ext/date/lib/timelib.h?r=1.1&p=1
Index: php-src/ext/date/lib/timelib.h
+++ php-src/ext/date/lib/timelib.h
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [EMAIL PROTECTED] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <[EMAIL PROTECTED]>
|
+----------------------------------------------------------------------+
*/
/* $Id: timelib.h,v 1.1 2005/06/16 17:12:41 derick Exp $ */
#include "timelib_structs.h"
#define TIMELIB_NONE 0x00
#define TIMELIB_OVERRIDE_TIME 0x01
#ifndef LONG_MAX
#define LONG_MAX 2147483647L
#endif
#ifndef LONG_MIN
#define LONG_MIN (- LONG_MAX - 1)
#endif
/* From dow.c */
timelib_sll timelib_day_of_week(timelib_sll y, timelib_sll m, timelib_sll d);
timelib_sll timelib_daynr_from_weeknr(timelib_sll y, timelib_sll w, timelib_sll
d);
/* From parse_date.re */
timelib_time *timelib_strtotime(char *s);
void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options);
/* From tm2unixtime.c */
void timelib_update_ts(timelib_time* time, timelib_tzinfo* tzi);
/* From unixtime2tm.c */
int timelib_apply_localtime(timelib_time *t, unsigned int localtime);
void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts);
void timelib_unixtime2local(timelib_time *tm, timelib_sll ts, timelib_tzinfo*
tz);
void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz);
/* From parse_tz.c */
timelib_tzinfo *timelib_parse_tzfile(char *timezone);
int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz);
timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo
*tz);
/* From timelib.c */
timelib_tzinfo* timelib_tzinfo_ctor();
void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr);
void timelib_time_tz_name_update(timelib_time* tm, char* tz_name);
void timelib_tzinfo_dtor(timelib_tzinfo *tz);
timelib_tzinfo* timelib_tzinfo_clone(timelib_tzinfo *tz);
timelib_time* timelib_time_ctor();
void timelib_time_dtor(timelib_time* t);
timelib_time_offset* timelib_time_offset_ctor();
void timelib_time_offset_dtor(timelib_time_offset* t);
signed long timelib_date_to_int(timelib_time *d, int *error);
void timelib_dump_date(timelib_time *d, int options);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php