summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/date/config.m42
-rw-r--r--ext/date/lib/astro.c301
-rw-r--r--ext/date/lib/astro.h51
-rw-r--r--ext/date/lib/parse_date.c169
-rw-r--r--ext/date/lib/parse_date.re15
-rw-r--r--ext/date/lib/timelib.c8
-rw-r--r--ext/date/lib/timelib.h8
-rw-r--r--ext/date/lib/timezonemap.h2
-rw-r--r--ext/date/lib/unixtime2tm.c51
-rw-r--r--ext/date/php_date.c51
-rw-r--r--ext/date/tests/bug33869.phpt12
-rw-r--r--ext/date/tests/bug34087.phpt8
-rw-r--r--ext/date/tests/bug34676.phpt2
-rw-r--r--ext/date/tests/bug34771.phpt2
-rw-r--r--ext/date/tests/bug35414.phpt8
-rw-r--r--ext/date/tests/bug35422.phpt4
-rw-r--r--ext/date/tests/bug35456.phpt6
-rw-r--r--ext/date/tests/bug35499.phpt4
-rw-r--r--ext/date/tests/date.phpt4
-rw-r--r--ext/date/tests/date_default_timezone_get-1.phpt8
-rw-r--r--ext/date/tests/date_default_timezone_set-1.phpt14
-rw-r--r--ext/date/tests/mktime-2.phpt2
-rw-r--r--ext/date/tests/mktime-3.phpt2
-rw-r--r--ext/date/tests/strtotime.phpt2
24 files changed, 579 insertions, 157 deletions
diff --git a/ext/date/config.m4 b/ext/date/config.m4
index 9e39d4f7e9..cbd732f4ed 100644
--- a/ext/date/config.m4
+++ b/ext/date/config.m4
@@ -5,7 +5,7 @@ sinclude(ext/date/lib/timelib.m4)
sinclude(lib/timelib.m4)
PHP_DATE_CFLAGS="-I@ext_builddir@/lib"
-timelib_sources="lib/dow.c lib/parse_date.c lib/parse_tz.c
+timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.c
lib/timelib.c lib/tm2unixtime.c lib/unixtime2tm.c"
PHP_NEW_EXTENSION(date, php_date.c $timelib_sources, no,, $PHP_DATE_CFLAGS)
diff --git a/ext/date/lib/astro.c b/ext/date/lib/astro.c
new file mode 100644
index 0000000000..6826238d4a
--- /dev/null
+++ b/ext/date/lib/astro.c
@@ -0,0 +1,301 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2005 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 |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Algorithms are taken from a public domain source by Paul |
+ | Schlyter, who wrote this in December 1992 |
+ +----------------------------------------------------------------------+
+ | Authors: Derick Rethans <derick@derickrethans.nl> |
+ +----------------------------------------------------------------------+
+ */
+
+/* $Id$ */
+
+#include <stdio.h>
+#include <math.h>
+#include "timelib.h"
+
+#define days_since_2000_Jan_0(y,m,d) \
+ (367L*(y)-((7*((y)+(((m)+9)/12)))/4)+((275*(m))/9)+(d)-730530L)
+
+#ifndef PI
+ #define PI 3.1415926535897932384
+#endif
+
+#define RADEG ( 180.0 / PI )
+#define DEGRAD ( PI / 180.0 )
+
+/* The trigonometric functions in degrees */
+
+#define sind(x) sin((x)*DEGRAD)
+#define cosd(x) cos((x)*DEGRAD)
+#define tand(x) tan((x)*DEGRAD)
+
+#define atand(x) (RADEG*atan(x))
+#define asind(x) (RADEG*asin(x))
+#define acosd(x) (RADEG*acos(x))
+#define atan2d(y,x) (RADEG*atan2(y,x))
+
+
+/* Following are some macros around the "workhorse" function __daylen__ */
+/* They mainly fill in the desired values for the reference altitude */
+/* below the horizon, and also selects whether this altitude should */
+/* refer to the Sun's center or its upper limb. */
+
+
+#include "astro.h"
+
+/******************************************************************/
+/* This function reduces any angle to within the first revolution */
+/* by subtracting or adding even multiples of 360.0 until the */
+/* result is >= 0.0 and < 360.0 */
+/******************************************************************/
+
+#define INV360 (1.0 / 360.0)
+
+/*****************************************/
+/* Reduce angle to within 0..360 degrees */
+/*****************************************/
+static double astro_revolution(double x)
+{
+ return (x - 360.0 * floor(x * INV360));
+}
+
+/*********************************************/
+/* Reduce angle to within +180..+180 degrees */
+/*********************************************/
+static double astro_rev180( double x )
+{
+ return (x - 360.0 * floor(x * INV360 + 0.5));
+}
+
+/*******************************************************************/
+/* This function computes GMST0, the Greenwich Mean Sidereal Time */
+/* at 0h UT (i.e. the sidereal time at the Greenwhich meridian at */
+/* 0h UT). GMST is then the sidereal time at Greenwich at any */
+/* time of the day. I've generalized GMST0 as well, and define it */
+/* as: GMST0 = GMST - UT -- this allows GMST0 to be computed at */
+/* other times than 0h UT as well. While this sounds somewhat */
+/* contradictory, it is very practical: instead of computing */
+/* GMST like: */
+/* */
+/* GMST = (GMST0) + UT * (366.2422/365.2422) */
+/* */
+/* where (GMST0) is the GMST last time UT was 0 hours, one simply */
+/* computes: */
+/* */
+/* GMST = GMST0 + UT */
+/* */
+/* where GMST0 is the GMST "at 0h UT" but at the current moment! */
+/* Defined in this way, GMST0 will increase with about 4 min a */
+/* day. It also happens that GMST0 (in degrees, 1 hr = 15 degr) */
+/* is equal to the Sun's mean longitude plus/minus 180 degrees! */
+/* (if we neglect aberration, which amounts to 20 seconds of arc */
+/* or 1.33 seconds of time) */
+/* */
+/*******************************************************************/
+
+static double astro_GMST0(double d)
+{
+ double sidtim0;
+ /* Sidtime at 0h UT = L (Sun's mean longitude) + 180.0 degr */
+ /* L = M + w, as defined in sunpos(). Since I'm too lazy to */
+ /* add these numbers, I'll let the C compiler do it for me. */
+ /* Any decent C compiler will add the constants at compile */
+ /* time, imposing no runtime or code overhead. */
+ sidtim0 = astro_revolution((180.0 + 356.0470 + 282.9404) + (0.9856002585 + 4.70935E-5) * d);
+ return sidtim0;
+}
+
+/* This function computes the Sun's position at any instant */
+
+/******************************************************/
+/* Computes the Sun's ecliptic longitude and distance */
+/* at an instant given in d, number of days since */
+/* 2000 Jan 0.0. The Sun's ecliptic latitude is not */
+/* computed, since it's always very near 0. */
+/******************************************************/
+static void astro_sunpos(double d, double *lon, double *r)
+{
+ double M, /* Mean anomaly of the Sun */
+ w, /* Mean longitude of perihelion */
+ /* Note: Sun's mean longitude = M + w */
+ e, /* Eccentricity of Earth's orbit */
+ E, /* Eccentric anomaly */
+ x, y, /* x, y coordinates in orbit */
+ v; /* True anomaly */
+
+ /* Compute mean elements */
+ M = astro_revolution(356.0470 + 0.9856002585 * d);
+ w = 282.9404 + 4.70935E-5 * d;
+ e = 0.016709 - 1.151E-9 * d;
+
+ /* Compute true longitude and radius vector */
+ E = M + e * RADEG * sind(M) * (1.0 + e * cosd(M));
+ x = cosd(E) - e;
+ y = sqrt(1.0 - e*e) * sind(E);
+ *r = sqrt(x*x + y*y); /* Solar distance */
+ v = atan2d(y, x); /* True anomaly */
+ *lon = v + w; /* True solar longitude */
+ if (*lon >= 360.0) {
+ *lon -= 360.0; /* Make it 0..360 degrees */
+ }
+}
+
+static void astro_sun_RA_dec(double d, double *RA, double *dec, double *r)
+{
+ double lon, obl_ecl, x, y, z;
+
+ /* Compute Sun's ecliptical coordinates */
+ astro_sunpos(d, &lon, r);
+
+ /* Compute ecliptic rectangular coordinates (z=0) */
+ x = *r * cosd(lon);
+ y = *r * sind(lon);
+
+ /* Compute obliquity of ecliptic (inclination of Earth's axis) */
+ obl_ecl = 23.4393 - 3.563E-7 * d;
+
+ /* Convert to equatorial rectangular coordinates - x is unchanged */
+ z = y * sind(obl_ecl);
+ y = y * cosd(obl_ecl);
+
+ /* Convert to spherical coordinates */
+ *RA = atan2d(y, x);
+ *dec = atan2d(z, sqrt(x*x + y*y));
+}
+
+/**
+ * Note: timestamp = unixtimestamp (NEEDS to be 00:00:00 UT)
+ * Eastern longitude positive, Western longitude negative
+ * Northern latitude positive, Southern latitude negative
+ * The longitude value IS critical in this function!
+ * altit = the altitude which the Sun should cross
+ * Set to -35/60 degrees for rise/set, -6 degrees
+ * for civil, -12 degrees for nautical and -18
+ * degrees for astronomical twilight.
+ * upper_limb: non-zero -> upper limb, zero -> center
+ * Set to non-zero (e.g. 1) when computing rise/set
+ * times, and to zero when computing start/end of
+ * twilight.
+ * *rise = where to store the rise time
+ * *set = where to store the set time
+ * Both times are relative to the specified altitude,
+ * and thus this function can be used to compute
+ * various twilight times, as well as rise/set times
+ * Return value: 0 = sun rises/sets this day, times stored at
+ * *trise and *tset.
+ * +1 = sun above the specified "horizon" 24 hours.
+ * *trise set to time when the sun is at south,
+ * minus 12 hours while *tset is set to the south
+ * time plus 12 hours. "Day" length = 24 hours
+ * -1 = sun is below the specified "horizon" 24 hours
+ * "Day" length = 0 hours, *trise and *tset are
+ * both set to the time when the sun is at south.
+ *
+ */
+int timelib_astro_rise_set_altitude(timelib_time *t_loc, double lon, double lat, double altit, int upper_limb, double *h_rise, double *h_set, timelib_sll *ts_rise, timelib_sll *ts_set)
+{
+ double d, /* Days since 2000 Jan 0.0 (negative before) */
+ sr, /* Solar distance, astronomical units */
+ sRA, /* Sun's Right Ascension */
+ sdec, /* Sun's declination */
+ sradius, /* Sun's apparent radius */
+ t, /* Diurnal arc */
+ tsouth, /* Time when Sun is at south */
+ sidtime; /* Local sidereal time */
+ timelib_time *t_utc;
+ timelib_sll timestamp;
+
+ int rc = 0; /* Return cde from function - usually 0 */
+
+ /* Normalize time */
+ t_loc->h = 12;
+ t_loc->i = t_loc->s = 0;
+ timelib_update_ts(t_loc, NULL);
+
+ /* Calculate TS belonging to UTC 00:00 of the current day */
+ t_utc = timelib_time_ctor();
+ t_utc->y = t_loc->y;
+ t_utc->m = t_loc->m;
+ t_utc->d = t_loc->d;
+ t_utc->h = t_utc->i = t_utc->s = 0;
+ timelib_update_ts(t_utc, NULL);
+
+ /* Compute d of 12h local mean solar time */
+ timestamp = t_loc->sse;
+ d = timelib_ts_to_juliandate(timestamp) - lon/360.0;
+
+ /* Compute local sidereal time of this moment */
+ sidtime = astro_revolution(astro_GMST0(d) + 180.0 + lon);
+
+ /* Compute Sun's RA + Decl at this moment */
+ astro_sun_RA_dec( d, &sRA, &sdec, &sr );
+
+ /* Compute time when Sun is at south - in hours UT */
+ tsouth = 12.0 - astro_rev180(sidtime - sRA) / 15.0;
+
+ /* Compute the Sun's apparent radius, degrees */
+ sradius = 0.2666 / sr;
+
+ /* Do correction to upper limb, if necessary */
+ if (upper_limb) {
+ altit -= sradius;
+ }
+
+ /* Compute the diurnal arc that the Sun traverses to reach */
+ /* the specified altitude altit: */
+ {
+ double cost;
+ cost = (sind(altit) - sind(lat) * sind(sdec)) / (cosd(lat) * cosd(sdec));
+ if (cost >= 1.0) {
+ rc = -1;
+ t = 0.0; /* Sun always below altit */
+
+ *ts_rise = *ts_set = t_utc->sse + (tsouth * 3600);
+ } else if (cost <= -1.0) {
+ rc = +1;
+ t = 12.0; /* Sun always above altit */
+
+ *ts_rise = t_loc->sse - (12 * 3600);
+ *ts_set = t_loc->sse + (12 * 3600);
+ } else {
+ t = acosd(cost) / 15.0; /* The diurnal arc, hours */
+
+ /* Store rise and set times - as Unix Timestamp */
+ *ts_rise = ((tsouth - t) * 3600) + t_utc->sse;
+ *ts_set = ((tsouth + t) * 3600) + t_utc->sse;
+
+ *h_rise = (tsouth - t);
+ *h_set = (tsouth + t);
+ }
+ }
+
+
+ /* Kill temporary time */
+ timelib_time_dtor(t_utc);
+
+ return rc;
+}
+
+double timelib_ts_to_juliandate(timelib_sll ts)
+{
+ double tmp;
+
+ tmp = ts;
+ tmp /= 86400;
+ tmp += 2440587.5;
+ tmp -= 2451543;
+
+ return tmp;
+}
diff --git a/ext/date/lib/astro.h b/ext/date/lib/astro.h
new file mode 100644
index 0000000000..7b85c76b74
--- /dev/null
+++ b/ext/date/lib/astro.h
@@ -0,0 +1,51 @@
+/* This macro computes the length of the day, from sunrise to sunset. */
+/* Sunrise/set is considered to occur when the Sun's upper limb is */
+/* 35 arc minutes below the horizon (this accounts for the refraction */
+/* of the Earth's atmosphere). */
+#define day_length(year,month,day,lon,lat) \
+ __daylen__( year, month, day, lon, lat, -35.0/60.0, 1 )
+
+/* This macro computes the length of the day, including civil twilight. */
+/* Civil twilight starts/ends when the Sun's center is 6 degrees below */
+/* the horizon. */
+#define day_civil_twilight_length(year,month,day,lon,lat) \
+ __daylen__( year, month, day, lon, lat, -6.0, 0 )
+
+/* This macro computes the length of the day, incl. nautical twilight. */
+/* Nautical twilight starts/ends when the Sun's center is 12 degrees */
+/* below the horizon. */
+#define day_nautical_twilight_length(year,month,day,lon,lat) \
+ __daylen__( year, month, day, lon, lat, -12.0, 0 )
+
+/* This macro computes the length of the day, incl. astronomical twilight. */
+/* Astronomical twilight starts/ends when the Sun's center is 18 degrees */
+/* below the horizon. */
+#define day_astronomical_twilight_length(year,month,day,lon,lat) \
+ __daylen__( year, month, day, lon, lat, -18.0, 0 )
+
+
+/* This macro computes times for sunrise/sunset. */
+/* Sunrise/set is considered to occur when the Sun's upper limb is */
+/* 35 arc minutes below the horizon (this accounts for the refraction */
+/* of the Earth's atmosphere). */
+#define timelib_astro_sun_rise_set(ts,lon,lat,hrise,hset,rise,set) \
+ timelib_astro_rise_set_altitude( ts, lon, lat, -35.0/60.0, 1, hrise, hset, rise, set )
+
+/* This macro computes the start and end times of civil twilight. */
+/* Civil twilight starts/ends when the Sun's center is 6 degrees below */
+/* the horizon. */
+#define civil_twilight(ts,lon,lat,start,end) \
+ timelib_astro_rise_set_altitude( ts, lon, lat, -6.0, 0, start, end )
+
+/* This macro computes the start and end times of nautical twilight. */
+/* Nautical twilight starts/ends when the Sun's center is 12 degrees */
+/* below the horizon. */
+#define nautical_twilight(ts,lon,lat,start,end) \
+ timelib_astro_rise_set_altitude( ts, lon, lat, -12.0, 0, start, end )
+
+/* This macro computes the start and end times of astronomical twilight. */
+/* Astronomical twilight starts/ends when the Sun's center is 18 degrees */
+/* below the horizon. */
+#define astronomical_twilight(ts,lon,lat,start,end) \
+ timelib_astro_rise_set_altitude( ts, lon, lat, -18.0, 0, start, end )
+
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c
index 72413fa470..73cd2a138f 100644
--- a/ext/date/lib/parse_date.c
+++ b/ext/date/lib/parse_date.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.9.11 on Sun Dec 18 21:52:20 2005 */
+/* Generated by re2c 0.9.12.dev on Mon Dec 19 13:18:44 2005 */
#line 1 "ext/date/lib/parse_date.re"
/*
+----------------------------------------------------------------------+
@@ -173,6 +173,10 @@ static timelib_tz_lookup_table timelib_timezone_fallbackmap[] = {
{ NULL, 0, 0, NULL },
};
+static timelib_tz_lookup_table timelib_timezone_utc[] = {
+ { "utc", 0, 0, "UTC" },
+};
+
static timelib_relunit const timelib_relunit_lookup[] = {
{ "sec", TIMELIB_SECOND, 1 },
{ "secs", TIMELIB_SECOND, 1 },
@@ -583,10 +587,11 @@ static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, in
int first_found = 0;
timelib_tz_lookup_table *tp, *first_found_elem;
timelib_tz_lookup_table *fmp;
-
- if (gmtoffset == -1 && !strcmp(word, "UTC")) {
- goto skip_name_match;
+
+ if (strcasecmp("utc", word) == 0) {
+ return timelib_timezone_utc;
}
+
for (tp = timelib_timezone_lookup; tp->name; tp++) {
if (strcasecmp(word, tp->name) == 0) {
if (!first_found) {
@@ -604,7 +609,7 @@ static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, in
if (first_found) {
return first_found_elem;
}
-skip_name_match:
+
/* Still didn't find anything, let's find the zone solely based on
* offset/isdst then */
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
@@ -723,7 +728,7 @@ static int scan(Scanner *s)
std:
s->tok = cursor;
s->len = 0;
-#line 832 "ext/date/lib/parse_date.re"
+#line 837 "ext/date/lib/parse_date.re"
{
@@ -762,7 +767,7 @@ std:
0, 0, 0, 0, 0, 0, 0, 0,
};
-#line 766 "ext/date/lib/parse_date.c"
+#line 771 "ext/date/lib/parse_date.c"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -854,7 +859,7 @@ yy2:
yy3:
YYDEBUG(3, *YYCURSOR);
-#line 1327 "ext/date/lib/parse_date.re"
+#line 1332 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@@ -864,7 +869,7 @@ yy3:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
-#line 861 "ext/date/lib/parse_date.c"
+#line 866 "ext/date/lib/parse_date.c"
yy4:
YYDEBUG(4, *YYCURSOR);
yych = *++YYCURSOR;
@@ -982,13 +987,13 @@ yy7:
yy8:
YYDEBUG(8, *YYCURSOR);
-#line 1393 "ext/date/lib/parse_date.re"
+#line 1398 "ext/date/lib/parse_date.re"
{
/* printf("unexpected character: #%d, %c ", *s->tok, *s->tok); */
s->errors++;
goto std;
}
-#line 975 "ext/date/lib/parse_date.c"
+#line 980 "ext/date/lib/parse_date.c"
yy9:
YYDEBUG(9, *YYCURSOR);
yyaccept = 0;
@@ -2042,11 +2047,11 @@ yy44:
yy45:
YYDEBUG(45, *YYCURSOR);
-#line 1382 "ext/date/lib/parse_date.re"
+#line 1387 "ext/date/lib/parse_date.re"
{
goto std;
}
-#line 1954 "ext/date/lib/parse_date.c"
+#line 1959 "ext/date/lib/parse_date.c"
yy46:
YYDEBUG(46, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2058,12 +2063,12 @@ yy47:
yy48:
YYDEBUG(48, *YYCURSOR);
-#line 1387 "ext/date/lib/parse_date.re"
+#line 1392 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
-#line 1965 "ext/date/lib/parse_date.c"
+#line 1970 "ext/date/lib/parse_date.c"
yy49:
YYDEBUG(49, *YYCURSOR);
yych = *++YYCURSOR;
@@ -2271,7 +2276,7 @@ yy67:
yy68:
YYDEBUG(68, *YYCURSOR);
-#line 1366 "ext/date/lib/parse_date.re"
+#line 1371 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@@ -2286,7 +2291,7 @@ yy68:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 2146 "ext/date/lib/parse_date.c"
+#line 2151 "ext/date/lib/parse_date.c"
yy69:
YYDEBUG(69, *YYCURSOR);
yych = *++YYCURSOR;
@@ -3263,7 +3268,7 @@ yy172:
yy173:
YYDEBUG(173, *YYCURSOR);
-#line 1310 "ext/date/lib/parse_date.re"
+#line 1315 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior;
@@ -3279,7 +3284,7 @@ yy173:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 2923 "ext/date/lib/parse_date.c"
+#line 2928 "ext/date/lib/parse_date.c"
yy174:
YYDEBUG(174, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5041,7 +5046,7 @@ yy341:
yy342:
YYDEBUG(342, *YYCURSOR);
-#line 1294 "ext/date/lib/parse_date.re"
+#line 1299 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@@ -5056,7 +5061,7 @@ yy342:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
-#line 4360 "ext/date/lib/parse_date.c"
+#line 4365 "ext/date/lib/parse_date.c"
yy343:
YYDEBUG(343, *YYCURSOR);
yyaccept = 1;
@@ -6048,7 +6053,7 @@ yy405:
yy406:
YYDEBUG(406, *YYCURSOR);
-#line 1113 "ext/date/lib/parse_date.re"
+#line 1118 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datetextual | datenoyear");
TIMELIB_INIT;
@@ -6060,7 +6065,7 @@ yy406:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 5236 "ext/date/lib/parse_date.c"
+#line 5241 "ext/date/lib/parse_date.c"
yy407:
YYDEBUG(407, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6271,7 +6276,7 @@ yy427:
yy428:
YYDEBUG(428, *YYCURSOR);
-#line 1338 "ext/date/lib/parse_date.re"
+#line 1343 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@@ -6298,7 +6303,7 @@ yy428:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
-#line 5430 "ext/date/lib/parse_date.c"
+#line 5435 "ext/date/lib/parse_date.c"
yy429:
YYDEBUG(429, *YYCURSOR);
yyaccept = 7;
@@ -6657,7 +6662,7 @@ yy464:
yy465:
YYDEBUG(465, *YYCURSOR);
-#line 1087 "ext/date/lib/parse_date.re"
+#line 1092 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoday");
TIMELIB_INIT;
@@ -6669,7 +6674,7 @@ yy465:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
-#line 5727 "ext/date/lib/parse_date.c"
+#line 5732 "ext/date/lib/parse_date.c"
yy466:
YYDEBUG(466, *YYCURSOR);
yyaccept = 6;
@@ -7042,7 +7047,7 @@ yy490:
yy491:
YYDEBUG(491, *YYCURSOR);
-#line 1225 "ext/date/lib/parse_date.re"
+#line 1230 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pgtextshort");
TIMELIB_INIT;
@@ -7054,7 +7059,7 @@ yy491:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
-#line 6060 "ext/date/lib/parse_date.c"
+#line 6065 "ext/date/lib/parse_date.c"
yy492:
YYDEBUG(492, *YYCURSOR);
yych = *++YYCURSOR;
@@ -8887,7 +8892,7 @@ yy592:
yy593:
YYDEBUG(593, *YYCURSOR);
-#line 1279 "ext/date/lib/parse_date.re"
+#line 1284 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@@ -8901,7 +8906,7 @@ yy593:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
-#line 7703 "ext/date/lib/parse_date.c"
+#line 7708 "ext/date/lib/parse_date.c"
yy594:
YYDEBUG(594, *YYCURSOR);
yyaccept = 1;
@@ -11235,7 +11240,7 @@ yy702:
yy703:
YYDEBUG(703, *YYCURSOR);
-#line 1126 "ext/date/lib/parse_date.re"
+#line 1131 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@@ -11246,7 +11251,7 @@ yy703:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 9824 "ext/date/lib/parse_date.c"
+#line 9829 "ext/date/lib/parse_date.c"
yy704:
YYDEBUG(704, *YYCURSOR);
yyaccept = 10;
@@ -11356,7 +11361,7 @@ yy713:
yy714:
YYDEBUG(714, *YYCURSOR);
-#line 916 "ext/date/lib/parse_date.re"
+#line 921 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@@ -11372,7 +11377,7 @@ yy714:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
-#line 9928 "ext/date/lib/parse_date.c"
+#line 9933 "ext/date/lib/parse_date.c"
yy715:
YYDEBUG(715, *YYCURSOR);
yych = *++YYCURSOR;
@@ -11392,7 +11397,7 @@ yy716:
yy717:
YYDEBUG(717, *YYCURSOR);
-#line 933 "ext/date/lib/parse_date.re"
+#line 938 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
@@ -11415,7 +11420,7 @@ yy717:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
-#line 9965 "ext/date/lib/parse_date.c"
+#line 9970 "ext/date/lib/parse_date.c"
yy718:
YYDEBUG(718, *YYCURSOR);
yyaccept = 11;
@@ -11658,7 +11663,7 @@ yy742:
yy743:
YYDEBUG(743, *YYCURSOR);
-#line 1060 "ext/date/lib/parse_date.re"
+#line 1065 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datefull");
TIMELIB_INIT;
@@ -11671,7 +11676,7 @@ yy743:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
-#line 10169 "ext/date/lib/parse_date.c"
+#line 10174 "ext/date/lib/parse_date.c"
yy744:
YYDEBUG(744, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12306,7 +12311,7 @@ yy811:
yy812:
YYDEBUG(812, *YYCURSOR);
-#line 1074 "ext/date/lib/parse_date.re"
+#line 1079 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date");
TIMELIB_INIT;
@@ -12318,7 +12323,7 @@ yy812:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
-#line 10678 "ext/date/lib/parse_date.c"
+#line 10683 "ext/date/lib/parse_date.c"
yy813:
YYDEBUG(813, *YYCURSOR);
yych = *++YYCURSOR;
@@ -12899,7 +12904,7 @@ yy857:
yy858:
YYDEBUG(858, *YYCURSOR);
-#line 1047 "ext/date/lib/parse_date.re"
+#line 1052 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnudateshort");
TIMELIB_INIT;
@@ -12911,7 +12916,7 @@ yy858:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 11179 "ext/date/lib/parse_date.c"
+#line 11184 "ext/date/lib/parse_date.c"
yy859:
YYDEBUG(859, *YYCURSOR);
yyaccept = 12;
@@ -12994,7 +12999,7 @@ yy866:
yy867:
YYDEBUG(867, *YYCURSOR);
-#line 1020 "ext/date/lib/parse_date.re"
+#line 1025 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("americanshort | american");
TIMELIB_INIT;
@@ -13008,7 +13013,7 @@ yy867:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
-#line 11258 "ext/date/lib/parse_date.c"
+#line 11263 "ext/date/lib/parse_date.c"
yy868:
YYDEBUG(868, *YYCURSOR);
yyaccept = 13;
@@ -13257,7 +13262,7 @@ yy899:
yy900:
YYDEBUG(900, *YYCURSOR);
-#line 1251 "ext/date/lib/parse_date.re"
+#line 1256 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@@ -13275,7 +13280,7 @@ yy900:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
-#line 11459 "ext/date/lib/parse_date.c"
+#line 11464 "ext/date/lib/parse_date.c"
yy901:
YYDEBUG(901, *YYCURSOR);
yyaccept = 14;
@@ -13671,7 +13676,7 @@ yy952:
yy953:
YYDEBUG(953, *YYCURSOR);
-#line 1238 "ext/date/lib/parse_date.re"
+#line 1243 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pgtextreverse");
TIMELIB_INIT;
@@ -13683,7 +13688,7 @@ yy953:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
-#line 11759 "ext/date/lib/parse_date.c"
+#line 11764 "ext/date/lib/parse_date.c"
yy954:
YYDEBUG(954, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13816,7 +13821,7 @@ yy964:
yy965:
YYDEBUG(965, *YYCURSOR);
-#line 1270 "ext/date/lib/parse_date.re"
+#line 1275 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@@ -13824,7 +13829,7 @@ yy965:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
-#line 11875 "ext/date/lib/parse_date.c"
+#line 11880 "ext/date/lib/parse_date.c"
yy966:
YYDEBUG(966, *YYCURSOR);
yych = *++YYCURSOR;
@@ -13960,7 +13965,7 @@ yy973:
yy974:
YYDEBUG(974, *YYCURSOR);
-#line 1100 "ext/date/lib/parse_date.re"
+#line 1105 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenodayrev");
TIMELIB_INIT;
@@ -13972,7 +13977,7 @@ yy974:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
-#line 12002 "ext/date/lib/parse_date.c"
+#line 12007 "ext/date/lib/parse_date.c"
yy975:
YYDEBUG(975, *YYCURSOR);
yych = *++YYCURSOR;
@@ -14181,7 +14186,7 @@ yy993:
yy994:
YYDEBUG(994, *YYCURSOR);
-#line 1206 "ext/date/lib/parse_date.re"
+#line 1211 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@@ -14199,7 +14204,7 @@ yy994:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
-#line 12189 "ext/date/lib/parse_date.c"
+#line 12194 "ext/date/lib/parse_date.c"
yy995:
YYDEBUG(995, *YYCURSOR);
++YYCURSOR;
@@ -14207,7 +14212,7 @@ yy995:
yy996:
YYDEBUG(996, *YYCURSOR);
-#line 1187 "ext/date/lib/parse_date.re"
+#line 1192 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@@ -14225,7 +14230,7 @@ yy996:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
-#line 12211 "ext/date/lib/parse_date.c"
+#line 12216 "ext/date/lib/parse_date.c"
yy997:
YYDEBUG(997, *YYCURSOR);
yych = *++YYCURSOR;
@@ -14294,7 +14299,7 @@ yy999:
yy1000:
YYDEBUG(1000, *YYCURSOR);
-#line 1174 "ext/date/lib/parse_date.re"
+#line 1179 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pgydotd");
TIMELIB_INIT;
@@ -14306,7 +14311,7 @@ yy1000:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
-#line 12284 "ext/date/lib/parse_date.c"
+#line 12289 "ext/date/lib/parse_date.c"
yy1001:
YYDEBUG(1001, *YYCURSOR);
yych = *++YYCURSOR;
@@ -14412,7 +14417,7 @@ yy1006:
yy1007:
YYDEBUG(1007, *YYCURSOR);
-#line 1138 "ext/date/lib/parse_date.re"
+#line 1143 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@@ -14423,7 +14428,7 @@ yy1007:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
-#line 12383 "ext/date/lib/parse_date.c"
+#line 12388 "ext/date/lib/parse_date.c"
yy1008:
YYDEBUG(1008, *YYCURSOR);
yych = *++YYCURSOR;
@@ -14521,7 +14526,7 @@ yy1017:
yy1018:
YYDEBUG(1018, *YYCURSOR);
-#line 1150 "ext/date/lib/parse_date.re"
+#line 1155 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx");
@@ -14544,7 +14549,7 @@ yy1018:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
-#line 12482 "ext/date/lib/parse_date.c"
+#line 12487 "ext/date/lib/parse_date.c"
yy1019:
YYDEBUG(1019, *YYCURSOR);
yych = *++YYCURSOR;
@@ -15160,7 +15165,7 @@ yy1108:
yy1109:
YYDEBUG(1109, *YYCURSOR);
-#line 1035 "ext/date/lib/parse_date.re"
+#line 1040 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date | iso8601dateslash | dateslash");
TIMELIB_INIT;
@@ -15171,7 +15176,7 @@ yy1109:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 12927 "ext/date/lib/parse_date.c"
+#line 12932 "ext/date/lib/parse_date.c"
yy1110:
YYDEBUG(1110, *YYCURSOR);
yyaccept = 19;
@@ -16124,7 +16129,7 @@ yy1200:
yy1201:
YYDEBUG(1201, *YYCURSOR);
-#line 957 "ext/date/lib/parse_date.re"
+#line 962 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@@ -16145,7 +16150,7 @@ yy1201:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
-#line 13715 "ext/date/lib/parse_date.c"
+#line 13720 "ext/date/lib/parse_date.c"
yy1202:
YYDEBUG(1202, *YYCURSOR);
yych = *++YYCURSOR;
@@ -16242,7 +16247,7 @@ yy1208:
yy1209:
YYDEBUG(1209, *YYCURSOR);
-#line 1002 "ext/date/lib/parse_date.re"
+#line 1007 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@@ -16259,7 +16264,7 @@ yy1209:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
-#line 13813 "ext/date/lib/parse_date.c"
+#line 13818 "ext/date/lib/parse_date.c"
yy1210:
YYDEBUG(1210, *YYCURSOR);
yyaccept = 22;
@@ -16578,7 +16583,7 @@ yy1233:
yy1234:
YYDEBUG(1234, *YYCURSOR);
-#line 892 "ext/date/lib/parse_date.re"
+#line 897 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@@ -16601,7 +16606,7 @@ yy1234:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 14099 "ext/date/lib/parse_date.c"
+#line 14104 "ext/date/lib/parse_date.c"
yy1235:
YYDEBUG(1235, *YYCURSOR);
yych = *++YYCURSOR;
@@ -16683,7 +16688,7 @@ yy1242:
yy1243:
YYDEBUG(1243, *YYCURSOR);
-#line 880 "ext/date/lib/parse_date.re"
+#line 885 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@@ -16694,7 +16699,7 @@ yy1243:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 14174 "ext/date/lib/parse_date.c"
+#line 14179 "ext/date/lib/parse_date.c"
yy1244:
YYDEBUG(1244, *YYCURSOR);
yych = *++YYCURSOR;
@@ -16708,7 +16713,7 @@ yy1245:
yy1246:
YYDEBUG(1246, *YYCURSOR);
-#line 870 "ext/date/lib/parse_date.re"
+#line 875 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@@ -16717,7 +16722,7 @@ yy1246:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 14191 "ext/date/lib/parse_date.c"
+#line 14196 "ext/date/lib/parse_date.c"
yy1247:
YYDEBUG(1247, *YYCURSOR);
yych = *++YYCURSOR;
@@ -16812,7 +16817,7 @@ yy1254:
yy1255:
YYDEBUG(1255, *YYCURSOR);
-#line 849 "ext/date/lib/parse_date.re"
+#line 854 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@@ -16820,7 +16825,7 @@ yy1255:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 14276 "ext/date/lib/parse_date.c"
+#line 14281 "ext/date/lib/parse_date.c"
yy1256:
YYDEBUG(1256, *YYCURSOR);
yych = *++YYCURSOR;
@@ -16846,7 +16851,7 @@ yy1257:
yy1258:
YYDEBUG(1258, *YYCURSOR);
-#line 858 "ext/date/lib/parse_date.re"
+#line 863 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@@ -16857,7 +16862,7 @@ yy1258:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 14307 "ext/date/lib/parse_date.c"
+#line 14312 "ext/date/lib/parse_date.c"
yy1259:
YYDEBUG(1259, *YYCURSOR);
yych = *++YYCURSOR;
@@ -16926,7 +16931,7 @@ yy1266:
yy1267:
YYDEBUG(1267, *YYCURSOR);
-#line 837 "ext/date/lib/parse_date.re"
+#line 842 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@@ -16937,10 +16942,10 @@ yy1267:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 14369 "ext/date/lib/parse_date.c"
+#line 14374 "ext/date/lib/parse_date.c"
}
}
-#line 1398 "ext/date/lib/parse_date.re"
+#line 1403 "ext/date/lib/parse_date.re"
}
diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re
index 50f2c0e9d5..63d70e593c 100644
--- a/ext/date/lib/parse_date.re
+++ b/ext/date/lib/parse_date.re
@@ -171,6 +171,10 @@ static timelib_tz_lookup_table timelib_timezone_fallbackmap[] = {
{ NULL, 0, 0, NULL },
};
+static timelib_tz_lookup_table timelib_timezone_utc[] = {
+ { "utc", 0, 0, "UTC" },
+};
+
static timelib_relunit const timelib_relunit_lookup[] = {
{ "sec", TIMELIB_SECOND, 1 },
{ "secs", TIMELIB_SECOND, 1 },
@@ -581,10 +585,11 @@ static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, in
int first_found = 0;
timelib_tz_lookup_table *tp, *first_found_elem;
timelib_tz_lookup_table *fmp;
-
- if (gmtoffset == -1 && !strcmp(word, "UTC")) {
- goto skip_name_match;
+
+ if (strcasecmp("utc", word) == 0) {
+ return timelib_timezone_utc;
}
+
for (tp = timelib_timezone_lookup; tp->name; tp++) {
if (strcasecmp(word, tp->name) == 0) {
if (!first_found) {
@@ -602,7 +607,7 @@ static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, in
if (first_found) {
return first_found_elem;
}
-skip_name_match:
+
/* Still didn't find anything, let's find the zone solely based on
* offset/isdst then */
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
@@ -792,7 +797,7 @@ pointeddate = day "." month "." year;
datefull = day ([ -.])* monthtext ([ -.])* year;
datenoday = monthtext ([ -.])* year4;
datenodayrev = year4 ([ -.])* monthtext;
-datetextual = monthtext ([ -.])* day [,.stndrh ]* year;
+datetextual = monthtext ([ -.])* day [,.stndrh ]* year;
datenoyear = monthtext ([ -.])* day [,.stndrh ]*;
datenoyearrev = day ([ -.])* monthtext;
datenocolon = year4 monthlz daylz;
diff --git a/ext/date/lib/timelib.c b/ext/date/lib/timelib.c
index 18bcf9fc11..be0dc1a91e 100644
--- a/ext/date/lib/timelib.c
+++ b/ext/date/lib/timelib.c
@@ -20,6 +20,7 @@
#include "timelib.h"
#include <ctype.h>
+#include <math.h>
#define TIMELIB_TIME_FREE(m) \
if (m) { \
@@ -139,6 +140,13 @@ signed long timelib_date_to_int(timelib_time *d, int *error)
return (signed long) d->sse;
}
+void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec)
+{
+ *hour = floor(h);
+ *min = floor((h - *hour) * 60);
+ *sec = (h - *hour - ((float) *min / 60)) * 3600;
+}
+
void timelib_dump_date(timelib_time *d, int options)
{
if ((options & 2) == 2) {
diff --git a/ext/date/lib/timelib.h b/ext/date/lib/timelib.h
index 127275903e..0b2f0fe0ee 100644
--- a/ext/date/lib/timelib.h
+++ b/ext/date/lib/timelib.h
@@ -62,7 +62,7 @@ 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_unixtime2local(timelib_time *tm, timelib_sll ts);
void timelib_update_from_sse(timelib_time *tm);
void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz);
@@ -91,4 +91,10 @@ 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);
+void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec);
+
+/* from astro.c */
+double timelib_ts_to_juliandate(timelib_sll ts);
+int timelib_astro_rise_set_altitude(timelib_time *time, double lon, double lat, double altit, int upper_limb, double *h_rise, double *h_set, timelib_sll *ts_rise, timelib_sll *ts_set);
+
#endif
diff --git a/ext/date/lib/timezonemap.h b/ext/date/lib/timezonemap.h
index 2cb341f6f3..84997964d6 100644
--- a/ext/date/lib/timezonemap.h
+++ b/ext/date/lib/timezonemap.h
@@ -885,7 +885,6 @@
{ "gmt", 0, 0, "GB" },
{ "gmt", 0, 0, "GB-Eire" },
{ "gmt", 0, 0, "GMT" },
- { "utc", 0, 0, "UTC" },
{ "gmt", 0, 0, "Iceland" },
{ "gst", 0, 14400, "Asia/Dubai" },
{ "gst", 0, 14400, "Asia/Bahrain" },
@@ -1622,6 +1621,7 @@
{ "r", 0, -18000, NULL },
{ "s", 0, -21600, NULL },
{ "t", 0, -25200, NULL },
+ { "utc", 0, 0, "UTC" },
{ "u", 0, -28800, NULL },
{ "v", 0, -32400, NULL },
{ "w", 0, -36000, NULL },
diff --git a/ext/date/lib/unixtime2tm.c b/ext/date/lib/unixtime2tm.c
index 984187d324..0187abbcfb 100644
--- a/ext/date/lib/unixtime2tm.c
+++ b/ext/date/lib/unixtime2tm.c
@@ -121,7 +121,6 @@ void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts)
tm->sse_uptodate = 1;
tm->tim_uptodate = 1;
tm->is_localtime = 0;
- tm->have_zone = 0;
}
void timelib_update_from_sse(timelib_time *tm)
@@ -138,8 +137,6 @@ void timelib_update_from_sse(timelib_time *tm)
timelib_unixtime2gmt(tm, tm->sse - (tm->z * 60));
- tm->is_localtime = 1;
- tm->have_zone = 1;
tm->z = z;
tm->dst = dst;
goto cleanup;
@@ -165,25 +162,45 @@ cleanup:
tm->have_zone = 1;
}
-void timelib_unixtime2local(timelib_time *tm, timelib_sll ts, timelib_tzinfo* tz)
+void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
{
timelib_time_offset *gmt_offset;
+ timelib_tzinfo *tz = tm->tz_info;
- gmt_offset = timelib_get_time_zone_info(ts, tz);
- timelib_unixtime2gmt(tm, ts + gmt_offset->offset);
+ tm->is_localtime = 1;
+ tm->have_zone = 1;
- /* we need to reset the sse here as unixtime2gmt modifies it */
- tm->sse = ts;
- tm->dst = gmt_offset->is_dst;
- tm->z = gmt_offset->offset;
- tm->tz_info = tz;
+ switch (tm->zone_type) {
+ case TIMELIB_ZONETYPE_ABBR:
+ case TIMELIB_ZONETYPE_OFFSET: {
+ int z = tm->z;
+ signed int dst = tm->dst;
+
+ timelib_unixtime2gmt(tm, ts - (tm->z * 60));
- timelib_time_tz_abbr_update(tm, gmt_offset->abbr);
- timelib_time_offset_dtor(gmt_offset);
+ tm->z = z;
+ tm->dst = dst;
+ break;
+ }
- tm->is_localtime = 1;
- tm->have_zone = 1;
- tm->zone_type = TIMELIB_ZONETYPE_ID;
+ case TIMELIB_ZONETYPE_ID:
+ gmt_offset = timelib_get_time_zone_info(ts, tz);
+ timelib_unixtime2gmt(tm, ts + gmt_offset->offset);
+
+ /* we need to reset the sse here as unixtime2gmt modifies it */
+ tm->sse = ts;
+ tm->dst = gmt_offset->is_dst;
+ tm->z = gmt_offset->offset;
+ tm->tz_info = tz;
+
+ timelib_time_tz_abbr_update(tm, gmt_offset->abbr);
+ timelib_time_offset_dtor(gmt_offset);
+ break;
+
+ default:
+ tm->is_localtime = 0;
+ tm->have_zone = 0;
+ }
}
void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz)
@@ -225,7 +242,7 @@ int timelib_apply_localtime(timelib_time *t, unsigned int localtime)
return -1;
}
- timelib_unixtime2local(t, t->sse, t->tz_info);
+ timelib_unixtime2local(t, t->sse);
} else {
/* Converting from local time to GMT time */
DEBUG(printf("Converting from local time to GMT time\n"););
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 114271fbbb..28adde0d85 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -241,6 +241,17 @@ PHP_MINIT_FUNCTION(date)
date_register_classes(TSRMLS_C);
+ REGISTER_STRING_CONSTANT("DATE_ATOM", DATE_FORMAT_ISO8601, CONST_CS | CONST_PERSISTENT);
+ REGISTER_STRING_CONSTANT("DATE_COOKIE", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
+ REGISTER_STRING_CONSTANT("DATE_ISO8601", DATE_FORMAT_ISO8601, CONST_CS | CONST_PERSISTENT);
+ REGISTER_STRING_CONSTANT("DATE_RFC822", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
+ REGISTER_STRING_CONSTANT("DATE_RFC850", DATE_FORMAT_RFC1036, CONST_CS | CONST_PERSISTENT);
+ REGISTER_STRING_CONSTANT("DATE_RFC1036", DATE_FORMAT_RFC1036, CONST_CS | CONST_PERSISTENT);
+ REGISTER_STRING_CONSTANT("DATE_RFC1123", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
+ REGISTER_STRING_CONSTANT("DATE_RFC2822", DATE_FORMAT_RFC2822, CONST_CS | CONST_PERSISTENT);
+ REGISTER_STRING_CONSTANT("DATE_RSS", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
+ REGISTER_STRING_CONSTANT("DATE_W3C", DATE_FORMAT_ISO8601, CONST_CS | CONST_PERSISTENT);
+
php_date_global_timezone_db = NULL;
php_date_global_timezone_db_enabled = 0;
@@ -697,7 +708,9 @@ PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localt
if (localtime) {
tzi = get_timezone_info(TSRMLS_C);
- timelib_unixtime2local(t, ts, tzi);
+ t->tz_info = tzi;
+ t->zone_type = TIMELIB_ZONETYPE_ID;
+ timelib_unixtime2local(t, ts);
} else {
tzi = NULL;
timelib_unixtime2gmt(t, ts);
@@ -725,7 +738,9 @@ PHPAPI int php_idate(char format, time_t ts, int localtime)
if (!localtime) {
TSRMLS_FETCH();
tzi = get_timezone_info(TSRMLS_C);
- timelib_unixtime2local(t, ts, tzi);
+ t->tz_info = tzi;
+ t->zone_type = TIMELIB_ZONETYPE_ID;
+ timelib_unixtime2local(t, ts);
} else {
tzi = NULL;
timelib_unixtime2gmt(t, ts);
@@ -904,13 +919,17 @@ PHP_FUNCTION(strtotime)
snprintf(initial_ts, 24, "@%lu", preset_ts);
t = timelib_strtotime(initial_ts, strlen(initial_ts), &error1, DATE_TIMEZONEDB); /* we ignore the error here, as this should never fail */
timelib_update_ts(t, tzi);
- timelib_unixtime2local(now, t->sse, tzi);
+ now->tz_info = tzi;
+ now->zone_type = TIMELIB_ZONETYPE_ID;
+ timelib_unixtime2local(now, t->sse);
timelib_time_dtor(t);
efree(initial_ts);
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s", &times, &time_len) != FAILURE) {
/* We have no initial timestamp */
now = timelib_time_ctor();
- timelib_unixtime2local(now, (timelib_sll) time(NULL), tzi);
+ now->tz_info = tzi;
+ now->zone_type = TIMELIB_ZONETYPE_ID;
+ timelib_unixtime2local(now, (timelib_sll) time(NULL));
} else {
RETURN_FALSE;
}
@@ -921,7 +940,7 @@ PHP_FUNCTION(strtotime)
ts = timelib_date_to_int(t, &error2);
/* if tz_info is not a copy, avoid double free */
- if (now->tz_info != tzi) {
+ if (now->tz_info != tzi && now->tz_info) {
timelib_tzinfo_dtor(now->tz_info);
}
if (t->tz_info != tzi) {
@@ -958,7 +977,9 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
timelib_unixtime2gmt(now, (timelib_sll) time(NULL));
} else {
tzi = get_timezone_info(TSRMLS_C);
- timelib_unixtime2local(now, (timelib_sll) time(NULL), tzi);
+ now->tz_info = tzi;
+ now->zone_type = TIMELIB_ZONETYPE_ID;
+ timelib_unixtime2local(now, (timelib_sll) time(NULL));
}
/* Fill in the new data */
switch (ZEND_NUM_ARGS()) {
@@ -1094,7 +1115,9 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
timelib_unixtime2gmt(ts, (timelib_sll) timestamp);
} else {
tzi = get_timezone_info(TSRMLS_C);
- timelib_unixtime2local(ts, (timelib_sll) timestamp, tzi);
+ ts->tz_info = tzi;
+ ts->zone_type = TIMELIB_ZONETYPE_ID;
+ timelib_unixtime2local(ts, (timelib_sll) timestamp);
}
ta.tm_sec = ts->s;
ta.tm_min = ts->i;
@@ -1187,7 +1210,9 @@ PHP_FUNCTION(localtime)
tzi = get_timezone_info(TSRMLS_C);
ts = timelib_time_ctor();
- timelib_unixtime2local(ts, (timelib_sll) timestamp, tzi);
+ ts->tz_info = tzi;
+ ts->zone_type = TIMELIB_ZONETYPE_ID;
+ timelib_unixtime2local(ts, (timelib_sll) timestamp);
array_init(return_value);
@@ -1231,7 +1256,9 @@ PHP_FUNCTION(getdate)
tzi = get_timezone_info(TSRMLS_C);
ts = timelib_time_ctor();
- timelib_unixtime2local(ts, (timelib_sll) timestamp, tzi);
+ ts->tz_info = tzi;
+ ts->zone_type = TIMELIB_ZONETYPE_ID;
+ timelib_unixtime2local(ts, (timelib_sll) timestamp);
array_init(return_value);
@@ -1403,7 +1430,9 @@ PHP_FUNCTION(date_create)
}
now = timelib_time_ctor();
- timelib_unixtime2local(now, (timelib_sll) time(NULL), tzi);
+ now->tz_info = tzi;
+ now->zone_type = TIMELIB_ZONETYPE_ID;
+ timelib_unixtime2local(now, (timelib_sll) time(NULL));
timelib_fill_holes(dateobj->time, now, 0);
timelib_update_ts(dateobj->time, tzi);
@@ -1522,7 +1551,7 @@ PHP_FUNCTION(date_timezone_set)
timelib_tzinfo_dtor(dateobj->time->tz_info);
}
timelib_set_timezone(dateobj->time, timelib_tzinfo_clone(tzobj->tz));
- timelib_unixtime2local(dateobj->time, dateobj->time->sse, dateobj->time->tz_info);
+ timelib_unixtime2local(dateobj->time, dateobj->time->sse);
}
PHP_FUNCTION(date_offset_get)
diff --git a/ext/date/tests/bug33869.phpt b/ext/date/tests/bug33869.phpt
index fc2c4833fa..6957a6b7e2 100644
--- a/ext/date/tests/bug33869.phpt
+++ b/ext/date/tests/bug33869.phpt
@@ -4,17 +4,17 @@ Bug #33869 (strtotime() doesn't parse "+1days" format)
<?php
date_default_timezone_set("UTC");
$tm = strtotime("2005-01-01 01:01:01");
- echo date(date::ISO8601, strtotime('+5days', $tm));
+ echo date(DATE_ISO8601, strtotime('+5days', $tm));
echo "\n";
- echo date(date::ISO8601, strtotime('+1month', $tm));
+ echo date(DATE_ISO8601, strtotime('+1month', $tm));
echo "\n";
- echo date(date::ISO8601, strtotime('+1year', $tm));
+ echo date(DATE_ISO8601, strtotime('+1year', $tm));
echo "\n";
- echo date(date::ISO8601, strtotime('+5 days', $tm));
+ echo date(DATE_ISO8601, strtotime('+5 days', $tm));
echo "\n";
- echo date(date::ISO8601, strtotime('+1 month', $tm));
+ echo date(DATE_ISO8601, strtotime('+1 month', $tm));
echo "\n";
- echo date(date::ISO8601, strtotime('+1 year', $tm));
+ echo date(DATE_ISO8601, strtotime('+1 year', $tm));
echo "\n";
?>
--EXPECT--
diff --git a/ext/date/tests/bug34087.phpt b/ext/date/tests/bug34087.phpt
index 76640c3954..3fa3885481 100644
--- a/ext/date/tests/bug34087.phpt
+++ b/ext/date/tests/bug34087.phpt
@@ -6,10 +6,10 @@ date_default_timezone_set("UTC");
echo "Y/m/d: ", strtotime("2005/8/12"), "\n";
echo "Y-m-d: ", strtotime("2005-8-12"), "\n";
-echo date(date::ISO8601, strtotime("2005/1/2")), "\n";
-echo date(date::ISO8601, strtotime("2005/01/02")), "\n";
-echo date(date::ISO8601, strtotime("2005/01/2")), "\n";
-echo date(date::ISO8601, strtotime("2005/1/02")), "\n";
+echo date(DATE_ISO8601, strtotime("2005/1/2")), "\n";
+echo date(DATE_ISO8601, strtotime("2005/01/02")), "\n";
+echo date(DATE_ISO8601, strtotime("2005/01/2")), "\n";
+echo date(DATE_ISO8601, strtotime("2005/1/02")), "\n";
?>
--EXPECT--
Y/m/d: 1123804800
diff --git a/ext/date/tests/bug34676.phpt b/ext/date/tests/bug34676.phpt
index 84f58e922a..6f616feb40 100644
--- a/ext/date/tests/bug34676.phpt
+++ b/ext/date/tests/bug34676.phpt
@@ -10,7 +10,7 @@ $tests = array(
foreach ($tests as $test) {
$t = strtotime("2005-12-22 ". $test);
- printf("%-10s => %s\n", $test, date(date::ISO8601, $t));
+ printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t));
}
?>
diff --git a/ext/date/tests/bug34771.phpt b/ext/date/tests/bug34771.phpt
index bed9511d60..a27d085a1d 100644
--- a/ext/date/tests/bug34771.phpt
+++ b/ext/date/tests/bug34771.phpt
@@ -13,7 +13,7 @@ $tests = array(
foreach ($tests as $test) {
$t = strtotime("2005-12-22 ". $test);
- printf("%-10s => %s\n", $test, date(date::ISO8601, $t));
+ printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t));
}
?>
diff --git a/ext/date/tests/bug35414.phpt b/ext/date/tests/bug35414.phpt
index e14f619e62..f6af5110fb 100644
--- a/ext/date/tests/bug35414.phpt
+++ b/ext/date/tests/bug35414.phpt
@@ -4,10 +4,10 @@ Bug #35414 (strtotime() no longer works with ordinal suffix)
<?php
date_default_timezone_set("UTC");
-echo date(date::ISO8601, strtotime("Sat 26th Nov 2005 18:18")) . "\n";
-echo date(date::ISO8601, strtotime("26th Nov", 1134340285)) . "\n";
-echo date(date::ISO8601, strtotime("Dec. 4th, 2005")) . "\n";
-echo date(date::ISO8601, strtotime("December 4th, 2005")) . "\n";
+echo date(DATE_ISO8601, strtotime("Sat 26th Nov 2005 18:18")) . "\n";
+echo date(DATE_ISO8601, strtotime("26th Nov", 1134340285)) . "\n";
+echo date(DATE_ISO8601, strtotime("Dec. 4th, 2005")) . "\n";
+echo date(DATE_ISO8601, strtotime("December 4th, 2005")) . "\n";
?>
--EXPECT--
2005-11-26T18:18:00+0000
diff --git a/ext/date/tests/bug35422.phpt b/ext/date/tests/bug35422.phpt
index c99d53f5a8..8273c75411 100644
--- a/ext/date/tests/bug35422.phpt
+++ b/ext/date/tests/bug35422.phpt
@@ -4,8 +4,8 @@ Bug #35422 (strtotime() does not parse times with UTC as timezone)
<?php
date_default_timezone_set("UTC");
-echo date(date::ISO8601, strtotime("July 1, 2000 00:00:00 UTC")) . "\n";
-echo date(date::ISO8601, strtotime("July 1, 2000 00:00:00 GMT")) . "\n";
+echo date(DATE_ISO8601, strtotime("July 1, 2000 00:00:00 UTC")) . "\n";
+echo date(DATE_ISO8601, strtotime("July 1, 2000 00:00:00 GMT")) . "\n";
?>
--EXPECT--
2000-07-01T00:00:00+0000
diff --git a/ext/date/tests/bug35456.phpt b/ext/date/tests/bug35456.phpt
index 907e6df412..6432b99445 100644
--- a/ext/date/tests/bug35456.phpt
+++ b/ext/date/tests/bug35456.phpt
@@ -6,9 +6,9 @@ date_default_timezone_set("UTC");
$t = 1133216119;
-echo date(date::ISO8601, strtotime("+ 1 day", $t)) . "\n";
-echo date(date::ISO8601, strtotime("+ 1 month", $t)) . "\n";
-echo date(date::ISO8601, strtotime("+ 1 week", $t)) . "\n";
+echo date(DATE_ISO8601, strtotime("+ 1 day", $t)) . "\n";
+echo date(DATE_ISO8601, strtotime("+ 1 month", $t)) . "\n";
+echo date(DATE_ISO8601, strtotime("+ 1 week", $t)) . "\n";
?>
--EXPECT--
2005-11-29T22:15:19+0000
diff --git a/ext/date/tests/bug35499.phpt b/ext/date/tests/bug35499.phpt
index c3cdf77b27..2fbcbf0bfa 100644
--- a/ext/date/tests/bug35499.phpt
+++ b/ext/date/tests/bug35499.phpt
@@ -4,8 +4,8 @@ Bug #35499 (strtotime() does not handle whitespace around the date string)
<?php
date_default_timezone_set("UTC");
-echo date(date::ISO8601, strtotime("11/20/2005 8:00 AM \r\n")) . "\n";
-echo date(date::ISO8601, strtotime(" 11/20/2005 8:00 AM \r\n")) . "\n";
+echo date(DATE_ISO8601, strtotime("11/20/2005 8:00 AM \r\n")) . "\n";
+echo date(DATE_ISO8601, strtotime(" 11/20/2005 8:00 AM \r\n")) . "\n";
var_dump(strtotime(" a "));
var_dump(strtotime(" \n "));
?>
diff --git a/ext/date/tests/date.phpt b/ext/date/tests/date.phpt
index 87cae0b310..ccdb3cda94 100644
--- a/ext/date/tests/date.phpt
+++ b/ext/date/tests/date.phpt
@@ -6,13 +6,13 @@ $tmp = "cr";
putenv ("TZ=GMT0");
for($a = 0;$a < strlen($tmp); $a++){
- echo $tmp{$a}, ': ', date($tmp{$a}, 1043324459)."\n";
+ echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n";
}
putenv ("TZ=MET");
for($a = 0;$a < strlen($tmp); $a++){
- echo $tmp{$a}, ': ', date($tmp{$a}, 1043324459)."\n";
+ echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n";
}
?>
--EXPECT--
diff --git a/ext/date/tests/date_default_timezone_get-1.phpt b/ext/date/tests/date_default_timezone_get-1.phpt
index 1771413735..d3508290ad 100644
--- a/ext/date/tests/date_default_timezone_get-1.phpt
+++ b/ext/date/tests/date_default_timezone_get-1.phpt
@@ -9,8 +9,8 @@ date.timezone=
echo date('e'), "\n";
?>
--EXPECTF--
-Strict Standards: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'Europe/London' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 3
-Europe/London
+Strict Standards: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 3
+UTC
-Strict Standards: date(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'Europe/London' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 4
-Europe/London \ No newline at end of file
+Strict Standards: date(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 4
+UTC
diff --git a/ext/date/tests/date_default_timezone_set-1.phpt b/ext/date/tests/date_default_timezone_set-1.phpt
index 3b422a8690..78face70a7 100644
--- a/ext/date/tests/date_default_timezone_set-1.phpt
+++ b/ext/date/tests/date_default_timezone_set-1.phpt
@@ -12,17 +12,17 @@ date.timezone=
$date4 = strtotime("2005-07-12 08:00:00");
echo date_default_timezone_get(), "\n";
- echo date(date::ISO8601, $date1), "\n";
- echo date(date::ISO8601, $date2), "\n";
- echo date(date::ISO8601, $date3), "\n";
- echo date(date::ISO8601, $date4), "\n";
+ echo date(DATE_ISO8601, $date1), "\n";
+ echo date(DATE_ISO8601, $date2), "\n";
+ echo date(DATE_ISO8601, $date3), "\n";
+ echo date(DATE_ISO8601, $date4), "\n";
?>
--EXPECTF--
-Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'Europe/London' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 3
+Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 3
-Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'Europe/London' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 4
+Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 4
America/Indiana/Knox
2005-01-12T03:00:00-0500
-2005-07-12T02:00:00-0500
+2005-07-12T03:00:00-0500
2005-01-12T08:00:00-0500
2005-07-12T08:00:00-0500
diff --git a/ext/date/tests/mktime-2.phpt b/ext/date/tests/mktime-2.phpt
index def140f3a0..aa259b577c 100644
--- a/ext/date/tests/mktime-2.phpt
+++ b/ext/date/tests/mktime-2.phpt
@@ -3,7 +3,7 @@ mktime() [2]
--INI--
error_reporting=2047
--FILE--
-<?php /* $Id$ */
+<?php
$timezones = array(
'GMT0',
'Europe/London'
diff --git a/ext/date/tests/mktime-3.phpt b/ext/date/tests/mktime-3.phpt
index d02caf644c..0d19074fc3 100644
--- a/ext/date/tests/mktime-3.phpt
+++ b/ext/date/tests/mktime-3.phpt
@@ -16,7 +16,7 @@ foreach ($tzs as $tz) {
if ($ret == FALSE) {
echo "out of range\n";
} else {
- echo date("F ".date::ISO8601, $ret), "\n";
+ echo date("F ".DATE_ISO8601, $ret), "\n";
}
}
echo "\n";
diff --git a/ext/date/tests/strtotime.phpt b/ext/date/tests/strtotime.phpt
index e8eea399d2..6560d7f1fd 100644
--- a/ext/date/tests/strtotime.phpt
+++ b/ext/date/tests/strtotime.phpt
@@ -8,7 +8,7 @@ $d[] = strtotime("2005-07-14 22:30:41");
$d[] = strtotime("2005-07-14 22:30:41 GMT");
foreach($d as $date) {
- echo date(date::ISO8601, $date), "\n";
+ echo date(DATE_ISO8601, $date), "\n";
}
?>
--EXPECT--