You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.1 KiB

  1. From: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
  2. Date: Sat, 2 May 2015 10:26:56 +0200
  3. Subject: Use system timezone
  4. Upstream don't want this patch. See
  5. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=730771 for a summary.
  6. This delta is recovered from previous versions of the system timezone patch in
  7. Debian, and appears to have inadvertently been dropped. Author unknown.
  8. To be used in tandem with use_embedded_timezonedb.patch and use_embedded_timezonedb_fixes.patch.
  9. ---
  10. ext/date/php_date.c | 17 +++++++++++++++++
  11. 1 file changed, 17 insertions(+)
  12. --- a/ext/date/php_date.c
  13. +++ b/ext/date/php_date.c
  14. @@ -538,6 +538,23 @@ static char* guess_timezone(const timeli
  15. DATEG(timezone_valid) = 1;
  16. return DATEG(default_timezone);
  17. }
  18. + /* Try to guess timezone from system information */
  19. + {
  20. + struct tm *ta, tmbuf;
  21. + time_t the_time;
  22. + char *tzid = NULL;
  23. +
  24. + the_time = time(NULL);
  25. + ta = php_localtime_r(&the_time, &tmbuf);
  26. + if (ta) {
  27. + tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, ta->tm_isdst);
  28. + }
  29. + if (! tzid) {
  30. + tzid = "UTC";
  31. + }
  32. +
  33. + return tzid;
  34. + }
  35. /* Fallback to UTC */
  36. return "UTC";
  37. }