note 104371 added to function.filemtime

From: Date: Sat, 11 Jun 2011 15:58:52 +0000
Subject: note 104371 added to function.filemtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-180441@lists.php.net to get a copy of this message
myselfasunder's code is an excellent workaround for the DST bug under Windows. However, it is correct in most of the USA only for files last modified in 2007 or later. For files created or modified before that date, the USA DST rules were different, so errors (differences with the local time that is reported by Windows) can still occur (the "I" format of the date function also shows the same error due to DST rule changes). For the USA, these errors happen for certain days in the months of March and November, which were the only months affected by the 2007 DST rules change. Note that Linux may not track such multiple DST rule changes adequately for the user's location, so this is not just a Windows problem. The problem is also not limited to users located in the USA. An adequate fix will require taking the date/time modified of the file and the DST rules of the user's locality, over their entire history, fully into account, along with the peculiarities of the underlying operating system (including its version). It is unlikely that individual operating systems will ever be fixed to reflect multiple DST rules and multiple user locations, which would be the solution in an ideal world. If someone were to research and develop a good general solution, it would be wonderful to add it to PHP itself, saving the need for all programmers needing this function from having to research and develop their own limited workarounds. This would clearly add value to PHP as being one of the only places in the world of computing where DST was handled correctly. A general solution is possible, but would not be easy: it would be based on a table containing complete DST rule histories for many localities around the world. It would also require a table of all OS peculiarities in calculating Unix Epoch times (UTC cannot be used to compute local time, bypassing OS peculiarities, since Linux, for example, stores dates/times only in Epoch time). Such a complete solution would need to be applied to all PHP functions that are subject to DST-related errors. Reference: http://en.wikipedia.org/wiki/Daylight_saving_time, sections Tz database and Microsoft Windows. ---- Server IP: 69.147.83.197 Probable Submitter: 74.65.139.79 ---- Manual Page -- http://www.php.net/manual/en/function.filemtime.php Edit -- https://master.php.net/note/edit/104371 Del: integrated -- https://master.php.net/note/delete/104371/integrated Del: useless -- https://master.php.net/note/delete/104371/useless Del: bad code -- https://master.php.net/note/delete/104371/bad+code Del: spam -- https://master.php.net/note/delete/104371/spam Del: non-english -- https://master.php.net/note/delete/104371/non-english Del: in docs -- https://master.php.net/note/delete/104371/in+docs Del: other reasons-- https://master.php.net/note/delete/104371 Reject -- https://master.php.net/note/reject/104371 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#180441) next »