Why does PHP consider the system's timezone unreliable, and is date_default_timezone_set() required?

From: Date: Mon, 17 Feb 2014 13:14:40 +0000
Subject: Why does PHP consider the system's timezone unreliable, and is date_default_timezone_set() required?
Groups: php.general 
Request: Send a blank email to php-general+get-322907@lists.php.net to get a copy of this message
This is probably a familiar error for anyone using PHP: > Message: date() [function.date]: It is not safe to rely on the system's timezone > settings. You are required to use the date.timezone setting or the > date_default_timezone_set() function. I know *what* this error means, I don't quite understand why PHP considers the system's timezone unreliable? All other programming languages I've used just use the systems timezone without problems, and most applications (servers applications, desktop apps) just use the system setting. For example, in C: #include <time.h> #include <stdio.h> int main() { char out[255]; time_t now = time(0); struct tm *ltime = localtime(&now); tzset(); strftime(out, sizeof(out), "%z, %Z", ltime); printf("%s\n", out); } Gives me: +0100, CET, which is the expected output. Is this somehow unreliable? This is all POSIX stuff, so I would expect it to work well on at least all POSIX sysyems, or am I missing something? PS. Please CC me, as I am not subscribed to this list! Thanks, Martin

« previous php.general (#322907) next »