Annotation of embedaddon/php/ext/calendar/tests/unixtojd.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: unixtojd()
3: --SKIPIF--
4: <?php include 'skipif.inc'; ?>
1.1.1.2 ! misho 5: --ENV--
! 6: TZ=UTC
1.1 misho 7: --FILE--
8: <?php
1.1.1.2 ! misho 9: // this line has no impact on test output on Windows
1.1 misho 10: putenv('TZ=UTC');
1.1.1.2 ! misho 11: // getenv('TZ') returns 'UTC' here
! 12: // putenv (basic_functions.c) does call tzset() when the env var being put is 'TZ'
! 13: // -adding a call direct to GetEnvironmentVariableA just before tzset() is called to check the value of 'TZ' returns 'UTC'
! 14: // putting a call to date_default_timezone_set() here doesn't help
! 15: //
! 16: // on Windows, the only thing that gets this test to pass is to put TZ=UTC in --ENV-- section
! 17: // -since putenv() is written to call tzset() when env var is TZ, I assume that putenv("TZ=UTC") is intended to work
! 18: // and should work on all platforms(including Windows).
! 19: // easter_date.phpt passes
! 20: // -doesn't use --ENV-- section
! 21: // -uses --INI-- section with date.timezone=UTC
! 22: // -uses putenv('TZ=UTC')
! 23: // date.timezone=UTC
! 24: // -if ommitted from easter_date.phpt, outputs DATE_TZ_ERRMSG warning
! 25: // -easter_date() calls mktime() and localtime()
! 26: // -whereas unixtojd(1000000000) calls localtime(1000000000)
! 27: // -if ommitted from unixtojd.phpt, does NOT output DATE_TZ_ERRMSG
! 28: //
! 29: // unixtojd() calls php_localtime_r() which for Pacific timezone systems, returns a time -8 hours
! 30: // -this incorrect localtime is passed to the julian date conversion (GregorianToSDN) function which works (probably correctly)
! 31: // but returns -1 day from expected because its input is -1 from expected
! 32:
1.1 misho 33: echo unixtojd(40000). "\n";
34: echo unixtojd(1000000000). "\n";
35: echo unixtojd(1152459009). "\n";
36: ?>
37: --EXPECT--
38: 2440588
39: 2452162
40: 2453926
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>