{{ message }}
This repository was archived by the owner on Oct 3, 2023. It is now read-only.
Fix bug that can cause the timestamp to be 1 second later.#161
Merged
Conversation
Member
|
Oops, we aren't providing env var credentials to forked builds for CI - investigating. |
chingor13
suggested changes
Apr 5, 2018
|
|
||
| /** | ||
| * Converts a float timestamp into a \DateTimeInterface object. | ||
| * |
Member
There was a problem hiding this comment.
PHP code style enforcer found: extra whitespace at end of this line.
| * @param float $when The Unix timestamp to be converted. | ||
| * @return \DateTimeInterface | ||
| */ | ||
| private function formatFloatTimeToDate($when) { |
Member
There was a problem hiding this comment.
PHP code style enforcer found: opening brace should go on new line.
Author
|
Thanks @chingor13, unfortunately I couldn't find instructions to do this format checks and run tests, etc. and I am super new in php so I have no idea what to do. |
chingor13
reviewed
Apr 5, 2018
chingor13
left a comment
Member
There was a problem hiding this comment.
Whoops, code review fail by me.
| list($usec, $sec) = explode(' ', microtime()); | ||
| $micro = sprintf("%06d", $usec * 1000000); | ||
| $when = new \DateTime(date('Y-m-d H:i:s.' . $micro)); | ||
| $when = formatFloatTimeToDate(microtime(true)); |
Member
There was a problem hiding this comment.
$when = $this->formatFloatTimeToDate(microtime(true));
Member
There was a problem hiding this comment.
$when = $this->formatFloatTimeToDate($when);
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This can happen because time was read twice when $when was null, once to get the usec and once to get the seconds, so if the initial time was 1.999 and second time was 2.001 then the result will be 2.999 which is 1 second later.