Plugin Directory

Changeset 3005363


Ignore:
Timestamp:
12/05/2023 02:28:18 AM (2 years ago)
Author:
binancepay
Message:

Fix the timestamp precision issue for versions of PHP prior to 7.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • binance-pay/trunk/class-wc-gateway-binancepay.php

    r3005362 r3005363  
    190190            $nonce = $this->generate_random_string();
    191191            $body = json_encode($req);
    192             $timestamp = round(microtime(true) * 1000);
     192            $microtime = microtime(true);
     193            $seconds = floor($microtime);
     194            $milliseconds = sprintf('%03d', ($microtime - $seconds) * 1000);
     195            $timestamp = $seconds . $milliseconds;
    193196            $payload = $timestamp . "\n" . $nonce . "\n" . $body . "\n";
    194197            $secretKey = $this->secret_key;
Note: See TracChangeset for help on using the changeset viewer.