Skip to content

Commit

Permalink
新增getUnixTimestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
AnonymHK committed Apr 4, 2024
1 parent 069b879 commit ec80aa9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Support/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -735,4 +735,21 @@ public static function getPublicKeyFromPrivateKey($private_key) {
$keyPair = $ec->keyFromPrivate($private_key);
return $keyPair->getPublic()->encode('hex');
}

/**
* 获取指点时间戳的Unix
*/
public static function getUnixTimestamp($minute = 0, $need_millisecond = true){
if($minute == 0){
$symbol = "now";
}
else if($minute > 0){
$symbol = "+{$minute}";
}
else{
$symbol = "{$minute}";
}

return $need_millisecond ? strtotime($symbol)."000" : strtotime($symbol);
}
}

0 comments on commit ec80aa9

Please sign in to comment.