Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37507590
en ru br
Репозитории ALT

Группа :: Разработка/Прочее
Пакет: php8.1

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: php8.0-debian-Use-system-timezone.patch
Скачать


From: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
Date: Sat, 2 May 2015 10:26:56 +0200
Subject: Use system timezone
Upstream don't want this patch. See
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=730771 for a summary.
This delta is recovered from previous versions of the system timezone patch in
Debian, and appears to have inadvertently been dropped. Author unknown.
To be used in tandem with use_embedded_timezonedb.patch and use_embedded_timezonedb_fixes.patch.
---
 ext/date/php_date.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 8c0f5a6..6b650ac 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -538,6 +538,23 @@ static char* guess_timezone(const timelib_tzdb *tzdb)
 		DATEG(timezone_valid) = 1;
 		return DATEG(default_timezone);
 	}
+	/* Try to guess timezone from system information */
+	{
+		struct tm *ta, tmbuf;
+		time_t     the_time;
+		char      *tzid = NULL;
+
+		the_time = time(NULL);
+		ta = php_localtime_r(&the_time, &tmbuf);
+		if (ta) {
+			tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, ta->tm_isdst);
+		}
+		if (! tzid) {
+			tzid = "UTC";
+		}
+
+		return tzid;
+	}
 	/* Fallback to UTC */
 	return "UTC";
 }
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin