Req #68029 [NEW]: PHP and monotonic date time

From: Date: Tue, 16 Sep 2014 16:07:41 +0000
Subject: Req #68029 [NEW]: PHP and monotonic date time
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187547@lists.php.net to get a copy of this message
From: roberto at spadim dot com dot br Operating system: any PHP version: 5.6.1RC1 Package: Date/time related Bug Type: Feature/Change Request Bug description:PHP and monotonic date time Description: ------------ Hi guys i didn't found a monotonic clock function for example: <?php system("date -s \"2014-09-16 13:01:00 BRT\"");sleep(1); echo microtime(1)."\n"; system("date -s \"2014-09-16 13:01:00 BRT\""); echo microtime(1)."\n"; ?> this script output # php date.php Tue Sep 16 13:01:00 BRT 2014 1410883261.0003 Tue Sep 16 13:01:00 BRT 2014 1410883260.0002 the clock is ok since i changed the date time, but, how to use a monotonic clock? i just found clock_gettime() using CLOCK_MONOTONIC with FPM (php-src/sapi/fpm/fpm/fpm_clock.c), but it don't export functions to php script space, maybe we could implement a monotonic clock function? Test script: --------------- <?php system("date -s \"2014-09-16 13:01:00 BRT\"");sleep(1); echo microtime(1)."\n"; system("date -s \"2014-09-16 13:01:00 BRT\""); echo microtime(1)."\n"; ?> Expected result: ---------------- correct output, since it's a feature request -- Edit bug report at https://bugs.php.net/bug.php?id=68029&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68029&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68029&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68029&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=68029&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=68029&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=68029&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=68029&r=needscript Try newer version: https://bugs.php.net/fix.php?id=68029&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=68029&r=support Expected behavior: https://bugs.php.net/fix.php?id=68029&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=68029&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=68029&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=68029&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68029&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=68029&r=dst IIS Stability: https://bugs.php.net/fix.php?id=68029&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=68029&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=68029&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=68029&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=68029&r=mysqlcfg

« previous php.bugs (#187547) next »