[TYPO3-v4] Daterange in TCA
Jigal van Hemert
jigal at xs4all.nl
Wed Jun 30 08:15:41 CEST 2010
Thomas "Thasmo" Deinhamer wrote:
> in the TCA of many tables/extensions I can find this:
>
> "'upper' => mktime(3, 14, 7, 1, 19, 2038),"
>
> I googled it and it seems this was a limitation/bug in PHP 4.2.3
> on Windows: http://bugs.php.net/bug.php?id=19414
The PHP manual [1] says:
"The valid range of a timestamp is typically from Fri, 13 Dec 1901
20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that
correspond to the minimum and maximum values for a 32-bit signed
integer). However, before PHP 5.1.0 this range was limited from
01-01-1970 to 19-01-2038 on some systems (e.g. Windows). "
As long as we continue to use an integer together with PHPs date and
time functions and as long as this format isn't changed to a 64-bit
signed integer the upper limit will be January 19th, 2038.
The bug you refer to crached PHP on Windows when trying to make
timestamp beyond that date.
There was for a period a limitation to the lower limit. A few years ago
the authors of a standard C-library which is normally used for handling
time and date functions decided to follow the definition of a UNIX
timestamp strictly. The definition said that the timestamp of any moment
before January 1st, 1970 is undefined; so they returned some negative
number. Before that update negative timestamps had always worked.
Some time later PHP supported negative timestamps again.
Since PHP 5.2.0 there is a DateTime class which stores timestamps in a
64-bit format, however MySQLs INT format is a 32-bit number. So we'd
have to change all timestamp fields in tables to a BIGINT and force
extensions to do the same. Seems like a real challenge...
[1] http://www.php.net/manual/en/function.date.php
--
Jigal van Hemert
skype:jigal.van.hemert
msn: jigal at xs4all.nl
http://twitter.com/jigalvh
More information about the TYPO3-project-v4
mailing list