Permalink
Browse files

Merged PHP-7.0 by hand due to conflicts.

  • Loading branch information...
derickr committed Aug 15, 2017
1 parent 3bc1226 commit 584db6f38fcac3e5e1ca4c770d3aacfff09ee371
Showing with 28,723 additions and 3,243 deletions.
  1. +2 −1 ext/date/lib/LICENSE.rst
  2. +15 −10 ext/date/lib/astro.c
  3. +58 −3 ext/date/lib/dow.c
  4. +42 −42 ext/date/lib/fallbackmap.h
  5. +4 −3 ext/date/lib/interval.c
  6. +2,538 −877 ext/date/lib/parse_date.c
  7. +23,670 −0 ext/date/lib/parse_date.c.orig
  8. +127 −111 ext/date/lib/parse_date.re
  9. +154 −133 ext/date/lib/parse_iso_intervals.c
  10. +3 −81 ext/date/lib/parse_iso_intervals.re
  11. +231 −64 ext/date/lib/parse_tz.c
  12. +65 −123 ext/date/lib/timelib.c
  13. +761 −40 ext/date/lib/timelib.h
  14. +5 −2 ext/date/lib/timelib.m4
  15. +158 −0 ext/date/lib/timelib_private.h
  16. +0 −316 ext/date/lib/timelib_structs.h
  17. +10 −482 ext/date/lib/timezonemap.h
  18. +48 −15 ext/date/lib/tm2unixtime.c
  19. +4 −22 ext/date/lib/unixtime2tm.c
  20. +42 −33 ext/date/php_date.c
  21. +0 −7 ext/date/tests/DateTimeZone_getLocation.phpt
  22. +12 −57 ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt
  23. +1 −1 ext/date/tests/bug35499.phpt
  24. +6 −6 ext/date/tests/bug41964.phpt
  25. +1 −1 ext/date/tests/bug45081.phpt
  26. +3 −3 ext/date/tests/bug68078_negative.phpt
  27. +2 −2 ext/date/tests/date_parse_001.phpt
  28. +9 −9 ext/date/tests/date_sun_info_001.phpt
  29. +9 −9 ext/date/tests/date_sun_info_002.phpt
  30. +3 −3 ext/date/tests/date_sun_info_003.phpt
  31. +154 −154 ext/date/tests/date_sun_info_variation1.phpt
  32. +149 −149 ext/date/tests/date_sun_info_variation2.phpt
  33. +153 −153 ext/date/tests/date_sun_info_variation3.phpt
  34. +30 −30 ext/date/tests/date_sunrise_variation1.phpt
  35. +10 −10 ext/date/tests/date_sunrise_variation3.phpt
  36. +34 −34 ext/date/tests/date_sunrise_variation4.phpt
  37. +5 −5 ext/date/tests/date_sunrise_variation5.phpt
  38. +36 −36 ext/date/tests/date_sunrise_variation6.phpt
  39. +5 −5 ext/date/tests/date_sunrise_variation7.phpt
  40. +30 −30 ext/date/tests/date_sunset_variation1.phpt
  41. +23 −23 ext/date/tests/date_sunset_variation3.phpt
  42. +23 −23 ext/date/tests/date_sunset_variation4.phpt
  43. +2 −2 ext/date/tests/date_sunset_variation5.phpt
  44. +36 −36 ext/date/tests/date_sunset_variation6.phpt
  45. +7 −7 ext/date/tests/date_sunset_variation7.phpt
  46. +24 −24 ext/date/tests/sunfuncts.phpt
  47. +13 −58 ext/date/tests/timezone_abbreviations_list_basic1.phpt
  48. +1 −3 ext/date/tests/timezone_name_from_abbr_basic1.phpt
  49. +3 −3 ext/intl/common/common_date.cpp
  50. +2 −2 ext/intl/timezone/timezone_class.cpp
View
@@ -1,6 +1,7 @@
The MIT License (MIT)
Copyright (c) 2015 Derick Rethans
Copyright (c) 2015-2017 Derick Rethans
Copyright (c) 2017 MongoDB, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
View
@@ -26,15 +26,15 @@
| Schlyter, who wrote this in December 1992 |
*/
#include "timelib.h"
#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
# define PI 3.1415926535897932384
#endif
#define RADEG ( 180.0 / PI )
@@ -230,7 +230,8 @@ int timelib_astro_rise_set_altitude(timelib_time *t_loc, double lon, double lat,
t_loc->i = t_loc->s = 0;
timelib_update_ts(t_loc, NULL);
/* Calculate TS belonging to UTC 00:00 of the current day */
/* Calculate TS belonging to UTC 00:00 of the current day, for input into
* the algorithm */
t_utc = timelib_time_ctor();
t_utc->y = t_loc->y;
t_utc->m = t_loc->m;
@@ -239,8 +240,8 @@ int timelib_astro_rise_set_altitude(timelib_time *t_loc, double lon, double lat,
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;
timestamp = t_utc->sse;
d = timelib_ts_to_j2000(timestamp) + 2 - lon/360.0;
/* Compute local sidereal time of this moment */
sidtime = astro_revolution(astro_GMST0(d) + 180.0 + lon);
@@ -295,14 +296,18 @@ int timelib_astro_rise_set_altitude(timelib_time *t_loc, double lon, double lat,
return rc;
}
double timelib_ts_to_juliandate(timelib_sll ts)
double timelib_ts_to_julianday(timelib_sll ts)
{
double tmp;
tmp = ts;
tmp /= 86400;
tmp += 2440587.5;
tmp -= 2451543;
tmp = (double) ts;
tmp /= (double) 86400;
tmp += (double) 2440587.5;
return tmp;
}
double timelib_ts_to_j2000(timelib_sll ts)
{
return timelib_ts_to_julianday(ts) - 2451545;
}
View
@@ -23,6 +23,7 @@
*/
#include "timelib.h"
#include "timelib_private.h"
static int m_table_common[13] = { -1, 0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1 = jan */
static int m_table_leap[13] = { -1, 6, 2, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 }; /* 1 = jan */
@@ -137,17 +138,71 @@ void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, time
}
}
timelib_sll timelib_daynr_from_weeknr(timelib_sll y, timelib_sll w, timelib_sll d)
void timelib_isodate_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iy, timelib_sll *iw, timelib_sll *id)
{
timelib_isoweek_from_date(y, m, d, iw, iy);
*id = timelib_day_of_week_ex(y, m, d, 1);
}
static timelib_sll timelib_daynr_from_weeknr_ex(timelib_sll iy, timelib_sll iw, timelib_sll id, timelib_sll *y)
{
timelib_sll dow, day;
/* Figure out the dayofweek for y-1-1 */
dow = timelib_day_of_week(y, 1, 1);
dow = timelib_day_of_week(iy, 1, 1);
/* then use that to figure out the offset for day 1 of week 1 */
day = 0 - (dow > 4 ? dow - 7 : dow);
/* and adjust the year to the natural year if we need to */
*y = (iw == 1 && day < 0 && id < dow) ? iy - 1 : iy;
/* Add weeks and days */
return day + ((w - 1) * 7) + d;
return day + ((iw - 1) * 7) + id;
}
timelib_sll timelib_daynr_from_weeknr(timelib_sll iy, timelib_sll iw, timelib_sll id)
{
timelib_sll dummy_iso_year;
return timelib_daynr_from_weeknr_ex(iy, iw, id, &dummy_iso_year);
}
void timelib_date_from_isodate(timelib_sll iy, timelib_sll iw, timelib_sll id, timelib_sll *y, timelib_sll *m, timelib_sll *d)
{
timelib_sll daynr = timelib_daynr_from_weeknr_ex(iy, iw, id, y) + 1;
int *table;
*m = 0;
if (daynr <= 0) {
*y += 1;
}
if (timelib_is_leap(*y)) {
table = ml_table_leap;
if (daynr > 366) {
*y += 1;
daynr -= 366;
}
} else {
table = ml_table_common;
if (daynr > 365) {
*y += 1;
daynr -= 365;
}
}
do {
daynr -= table[*m];
(*m)++;
} while (daynr > table[*m]);
if (daynr <= 0) {
daynr += 31;
*y -= 1;
*m = 12;
}
*d = daynr;
}
int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s)
View
@@ -1,42 +1,42 @@
{ "sst", 0, -660, "Pacific/Apia" },
{ "hst", 0, -600, "Pacific/Honolulu" },
{ "akst", 0, -540, "America/Anchorage" },
{ "akdt", 1, -480, "America/Anchorage" },
{ "pst", 0, -480, "America/Los_Angeles" },
{ "pdt", 1, -420, "America/Los_Angeles" },
{ "mst", 0, -420, "America/Denver" },
{ "mdt", 1, -360, "America/Denver" },
{ "cst", 0, -360, "America/Chicago" },
{ "cdt", 1, -300, "America/Chicago" },
{ "est", 0, -300, "America/New_York" },
{ "vet", 0, -270, "America/Caracas" },
{ "edt", 1, -240, "America/New_York" },
{ "ast", 0, -240, "America/Halifax" },
{ "adt", 1, -180, "America/Halifax" },
{ "brt", 0, -180, "America/Sao_Paulo" },
{ "brst", 1, -120, "America/Sao_Paulo" },
{ "azost", 0, -60, "Atlantic/Azores" },
{ "azodt", 1, 0, "Atlantic/Azores" },
{ "gmt", 0, 0, "Europe/London" },
{ "bst", 1, 60, "Europe/London" },
{ "cet", 0, 60, "Europe/Paris" },
{ "cest", 1, 120, "Europe/Paris" },
{ "eet", 0, 120, "Europe/Helsinki" },
{ "eest", 1, 180, "Europe/Helsinki" },
{ "msk", 0, 180, "Europe/Moscow" },
{ "msd", 1, 240, "Europe/Moscow" },
{ "gst", 0, 240, "Asia/Dubai" },
{ "pkt", 0, 300, "Asia/Karachi" },
{ "ist", 0, 330, "Asia/Kolkata" },
{ "npt", 0, 345, "Asia/Katmandu" },
{ "yekt", 1, 360, "Asia/Yekaterinburg" },
{ "novst", 1, 420, "Asia/Novosibirsk" },
{ "krat", 0, 420, "Asia/Krasnoyarsk" },
{ "cst", 0, 480, "Asia/Shanghai" },
{ "krast", 1, 480, "Asia/Krasnoyarsk" },
{ "jst", 0, 540, "Asia/Tokyo" },
{ "est", 0, 600, "Australia/Melbourne" },
{ "cst", 1, 630, "Australia/Adelaide" },
{ "est", 1, 660, "Australia/Melbourne" },
{ "nzst", 0, 720, "Pacific/Auckland" },
{ "nzdt", 1, 780, "Pacific/Auckland" },
{ "sst", 0, -660 * 60, "Pacific/Apia" },
{ "hst", 0, -600 * 60, "Pacific/Honolulu" },
{ "akst", 0, -540 * 60, "America/Anchorage" },
{ "akdt", 1, -480 * 60, "America/Anchorage" },
{ "pst", 0, -480 * 60, "America/Los_Angeles" },
{ "pdt", 1, -420 * 60, "America/Los_Angeles" },
{ "mst", 0, -420 * 60, "America/Denver" },
{ "mdt", 1, -360 * 60, "America/Denver" },
{ "cst", 0, -360 * 60, "America/Chicago" },
{ "cdt", 1, -300 * 60, "America/Chicago" },
{ "est", 0, -300 * 60, "America/New_York" },
{ "vet", 0, -270 * 60, "America/Caracas" },
{ "edt", 1, -240 * 60, "America/New_York" },
{ "ast", 0, -240 * 60, "America/Halifax" },
{ "adt", 1, -180 * 60, "America/Halifax" },
{ "brt", 0, -180 * 60, "America/Sao_Paulo" },
{ "brst", 1, -120 * 60, "America/Sao_Paulo" },
{ "azost", 0, -60 * 60, "Atlantic/Azores" },
{ "azodt", 1, 0 * 60, "Atlantic/Azores" },
{ "gmt", 0, 0 * 60, "Europe/London" },
{ "bst", 1, 60 * 60, "Europe/London" },
{ "cet", 0, 60 * 60, "Europe/Paris" },
{ "cest", 1, 120 * 60, "Europe/Paris" },
{ "eet", 0, 120 * 60, "Europe/Helsinki" },
{ "eest", 1, 180 * 60, "Europe/Helsinki" },
{ "msk", 0, 180 * 60, "Europe/Moscow" },
{ "msd", 1, 240 * 60, "Europe/Moscow" },
{ "gst", 0, 240 * 60, "Asia/Dubai" },
{ "pkt", 0, 300 * 60, "Asia/Karachi" },
{ "ist", 0, 330 * 60, "Asia/Kolkata" },
{ "npt", 0, 345 * 60, "Asia/Katmandu" },
{ "yekt", 1, 360 * 60, "Asia/Yekaterinburg" },
{ "novst", 1, 420 * 60, "Asia/Novosibirsk" },
{ "krat", 0, 420 * 60, "Asia/Krasnoyarsk" },
{ "cst", 0, 480 * 60, "Asia/Shanghai" },
{ "krast", 1, 480 * 60, "Asia/Krasnoyarsk" },
{ "jst", 0, 540 * 60, "Asia/Tokyo" },
{ "est", 0, 600 * 60, "Australia/Melbourne" },
{ "cst", 1, 630 * 60, "Australia/Adelaide" },
{ "est", 1, 660 * 60, "Australia/Melbourne" },
{ "nzst", 0, 720 * 60, "Pacific/Auckland" },
{ "nzdt", 1, 780 * 60, "Pacific/Auckland" },
View
@@ -23,6 +23,7 @@
*/
#include "timelib.h"
#include "timelib_private.h"
#include <math.h>
timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
@@ -65,7 +66,7 @@ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
rt->h = two->h - one->h;
rt->i = two->i - one->i;
rt->s = two->s - one->s;
rt->f = two->f - one->f;
rt->us = two->us - one->us;
if (one_backup.dst == 0 && two_backup.dst == 1 && two->sse >= one->sse + 86400 - dst_corr) {
rt->h += dst_h_corr;
rt->i += dst_m_corr;
@@ -111,7 +112,7 @@ timelib_time *timelib_add(timelib_time *old_time, timelib_rel_time *interval)
t->relative.h = interval->h * bias;
t->relative.i = interval->i * bias;
t->relative.s = interval->s * bias;
t->relative.f = interval->f * bias;
t->relative.us = interval->us * bias;
}
t->have_relative = 1;
t->sse_uptodate = 0;
@@ -147,7 +148,7 @@ timelib_time *timelib_sub(timelib_time *old_time, timelib_rel_time *interval)
t->relative.h = 0 - (interval->h * bias);
t->relative.i = 0 - (interval->i * bias);
t->relative.s = 0 - (interval->s * bias);
t->relative.f = 0 - (interval->f * bias);
t->relative.us = 0 - (interval->us * bias);
t->have_relative = 1;
t->sse_uptodate = 0;
Oops, something went wrong.

0 comments on commit 584db6f

Please sign in to comment.