-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[unit tests] 1 second less #11888
[unit tests] 1 second less #11888
Conversation
Code review failed.
test at console: and: |
how do you test this at console? what's the command? i only tested on online travis. Also i think DateTime supports microseconds since php 5.2.2 |
On local computer type command: You should see:
|
You can test online at http://sandbox.onlinephpfunctions.com/code/357b85e44650699c371f7c947a800b6e102d922f |
I tought JDate was extended to have microseconds too We could do something like this here https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/date/date.php#L107 for joomla to have the correct 'now' up to microsecond but i really don't know the impacts of this. if ($date === 'now')
{
$now = microtime(true);
$micro = sprintf("%06d", ($now - floor($now)) * 1000000);
$date = date('Y-m-d H:i:s.' . $micro, $now);
} But, for now the 'now' is in seconds. i will change this PR to 1 second them. |
Since |
Does adding microseconds when constructing a DateTime |
I don't know, I don't generally work with microseconds when using time based data (at least I haven't had a use case for it in 5+ years). |
i actually use microseconds a lot for performance tests. |
Quick glance through the PHP docs says yes it is supported (use |
Patched microseconds here #11890 |
I have tested this item ✅ successfully on This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11888. |
Summary of Changes
Reduce unit tests time a little further, but removing to 1 seconds sleep in
JFactoryTest::testGetDateNow
(one line changed).Testing Instructions
Unit tested passed.
Code review
Documentation Changes Required
None.