Skip to content

[Uid] Fix time to float conversion #40003

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

Merged
merged 1 commit into from
Jan 27, 2021

Conversation

fancyweb
Copy link
Contributor

@fancyweb fancyweb commented Jan 27, 2021

Q A
Branch? 5.2
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

On 32b systems, when the timestamp is before the UNIX epoch, the result is currently shifted by 1. Inverting all the bits is not enough, we need to add 1. I guess https://en.wikipedia.org/wiki/Two%27s_complement is relevant here?

Alternative:

$time = -1 * self::toBase(self::add($time ^ "\xff\xff\xff\xff\xff\xff\xff\xff", "\x00\x00\x00\x00\x00\x00\x00\x01"), self::BASE10);

@carsonbot
Copy link

Hey!

I appreciate you submitting this PR.

But you have made this PR towards a branch that is not maintained anymore. :/
Could you update the PR base branch to target one of these branches instead? 4.4, 5.2.

Cheers!

Carsonbot

@carsonbot carsonbot added the Bug label Jan 27, 2021
@nicolas-grekas nicolas-grekas added this to the 5.2 milestone Jan 27, 2021
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(for 5.2, 5.1 is EOLed now)

@fancyweb fancyweb changed the base branch from 5.1 to 5.2 January 27, 2021 17:12
@fancyweb fancyweb force-pushed the uid/fix-32b-time-to-float branch from f90978a to 9680a27 Compare January 27, 2021 17:12
@nicolas-grekas
Copy link
Member

Thank you @fancyweb.

@nicolas-grekas nicolas-grekas merged commit 6a935bb into symfony:5.2 Jan 27, 2021
@fancyweb fancyweb deleted the uid/fix-32b-time-to-float branch January 27, 2021 18:14
@fabpot fabpot mentioned this pull request Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants