Skip to content

Fixed $timestamp in hmacAuthorizationToken()#12

Open
garvin wants to merge 3 commits intopayeezy:masterfrom
garvin:master
Open

Fixed $timestamp in hmacAuthorizationToken()#12
garvin wants to merge 3 commits intopayeezy:masterfrom
garvin:master

Conversation

@garvin
Copy link

@garvin garvin commented Apr 1, 2016

Old timestamp method used time() * 1000 [which on many systems is a float (and only accurate to the second)] & converting that into a string, resulting in incorrect values:

$timestamp = strval(time()*1000); // example: '1.45952654E+12'

New method creates accurate, correct values:

$timestamp = sprintf('%.0f', array_sum(explode(' ', microtime())) * 1000); // example: '1459526540161'

garvin and others added 3 commits September 10, 2015 11:42
Instead of using microtime(true) to generate a millisecond timestamp, switched to a more accurate microtime() method (although for milliseconds, microtime(true) and microtime() methods were always the same in my testing).
Left it off in previous commits and shouldn't have.
@davidadas
Copy link

Probably want to squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants