[PHP-DEV] PHP 4.0 Bug #8828 Updated: mktime using mday<=0 From: dieter <email protected>
Date: 01/27/01

ID: 8828
User Update by: dieter <email protected>
Old-Status: Closed
Status: Open
Bug Type: Date/time related
Description: mktime using mday<=0

I have send a bug report to darwin-developers and
apple, too, but

i have check some UNIX-systems and i haven't found
any man-page, where is describe what should be
happend on "tm_mday" <= 0.
IMHO this is a undocumented feature, which is used by
PHP.

man mktime (Linux 2.2.13)
------------------------------------
       tm_mday
              The day of the month, in the range 1 to 31.

Sun Release 4.1
----------------------
       int tm_mday; /* day of month (1 - 31) */

SunOS 5.5
---------------
       int tm_mday; /* day of the month - [1, 31] */

HP-UX Release 10.20
------------------------------
       int tm_mday; /* day of month - [1,31] */

HP-UX Release 11.00
-------------------------------
       int tm_mday; /* day of month - [1,31] */

AIX 4.3.2
------------

       int tm_mday; /* Day of month (1 - 31) */

Darwin 1.0.2
-----------------
       int tm_mday; /* day of month (1 - 31) */

I think i should by much better to check mktime() on
configure and set a #define for compilation. Only on
"datetime.c" must be made a patch to support MacOS
X's / Darwin's mktime()-systemcall, i think!

Previous Comments:
---------------------------------------------------------------------------

[2001-01-22 22:32:57] jimw <email protected>
macos x is behaving in a non-standard way. we just use the underlying mktime() function.

you might try reporting it to the darwin developers.

http://www.opensource.apple.com/projects/bugs.html

---------------------------------------------------------------------------

[2001-01-21 08:06:36] dieter <email protected>
On PHP documantation:
mktime(hour,min,sec, year,0,mon) refers the last day of
month 'mon-1'. On MacOS X this failed, there it refers
the first day of month 'mon' and mktime(hour,min,sec,
year,-1,mon) refers the last day of month 'mon-1'.

See the test:

[aragorn:~/Downloads] dieter% cat A.c
#include <stdio.h>
#include <time.h>

main()
{
        struct tm mytm;
        int i;

        mytm.tm_sec = 0; mytm.tm_min = 0;
        mytm.tm_hour = 0; mytm.tm_year = 101;
        mytm.tm_wday = 0; mytm.tm_yday = 0;
        mytm.tm_isdst = 0; mytm.tm_gmtoff = 0;
        mytm.tm_zone = 0;

        for (i = 2; i >= -2; i--)
        {
                mytm.tm_mday = i;
                mytm.tm_mon = 2;
                printf ("%02d.%02d ",
                           mytm.tm_mday, mytm.tm_mon+1);
                printf (" --> %ld", mktime(&mytm));
                printf (" --> %02d.%02dn",
                           mytm.tm_mday, mytm.tm_mon+1);
        }
}
[aragorn:~/Downloads] dieter% cc -o A A.c
[aragorn:~/Downloads] dieter% ./A
02.03 --> 983487600 --> 02.03
01.03 --> 983401200 --> 01.03
00.03 --> 983401200 --> 01.03
-1.03 --> 983314800 --> 28.02
-2.03 --> 983228400 --> 27.02
[aragorn:~/Downloads] dieter%

---------------------------------------------------------------------------

Full Bug description available at: http://bugs.php.net/?id=8828

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>