PHP  
 PHP_HEAD
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/date/tests/bug48187.phpt ('Bug #48187 (DateTime::diff() corrupting microtime() result)')

Script

1: <?php
2: date_default_timezone_set
('UTC');
3:
4:
// two arbitrary dates
5:
$date1 = new DateTime('2005-07-23');
6:
$date2 = new DateTime('2006-02-14');
7:
8:
$begin_u microtime(true);
9:
$begin_t time();
10:
11: if (
microtime(true) - $begin_u 1) {
12:     
var_dump('microtime() difference less 1 second');
13: } else {
14:     
var_dump('microtime() difference greater or equal 1 second');
15: }
16:
17: if (
time() - $begin_t 1) {
18:     
var_dump('time() difference less 1 second');
19: } else {
20:     
var_dump('time() difference greater or equal 1 second');
21: }
22:
?>
23:

Expected

string(36) "microtime() difference less 1 second"
string(31) "time() difference less 1 second"

Output

string(36) "microtime() difference less 1 second"
string(43) "time() difference greater or equal 1 second"

Diff

002+ string(43) "time() difference greater or equal 1 second"
002- string(31) "time() difference less 1 second"

 

Generated at Mon, 04 Aug 2014 15:49:20 +0000 (15 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.