lede-packages-rs

git clone git://archive.git.mtrnord.blog/MTRNord/lede-packages-rs.git
Log | Files | Refs | README | LICENSE

0032-Use-system-timezone.patch (1272B)


      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 
      5 Upstream don't want this patch. See
      6 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=730771 for a summary.
      7 
      8 This delta is recovered from previous versions of the system timezone patch in
      9 Debian, and appears to have inadvertently been dropped. Author unknown.
     10 
     11 To be used in tandem with use_embedded_timezonedb.patch and use_embedded_timezonedb_fixes.patch.
     12 ---
     13  ext/date/php_date.c | 17 +++++++++++++++++
     14  1 file changed, 17 insertions(+)
     15 
     16 diff --git a/ext/date/php_date.c b/ext/date/php_date.c
     17 index cbe6e91..1999c83 100644
     18 --- a/ext/date/php_date.c
     19 +++ b/ext/date/php_date.c
     20 @@ -1003,6 +1003,23 @@ static char* guess_timezone(const timelib_tzdb *tzdb)
     21  		DATEG(timezone_valid) = 1;
     22  		return DATEG(default_timezone);
     23  	}
     24 +	/* Try to guess timezone from system information */
     25 +	{
     26 +		struct tm *ta, tmbuf;
     27 +		time_t     the_time;
     28 +		char      *tzid = NULL;
     29 +
     30 +		the_time = time(NULL);
     31 +		ta = php_localtime_r(&the_time, &tmbuf);
     32 +		if (ta) {
     33 +			tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, ta->tm_isdst);
     34 +		}
     35 +		if (! tzid) {
     36 +			tzid = "UTC";
     37 +		}
     38 +
     39 +		return tzid;
     40 +	}
     41  	/* Fallback to UTC */
     42  	return "UTC";
     43  }