mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-23 06:51:27 +00:00
18 lines
No EOL
298 B
PHP
18 lines
No EOL
298 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use Illuminate\Support\Carbon;
|
|
|
|
class SnowflakeService {
|
|
|
|
public static function byDate(Carbon $ts = null)
|
|
{
|
|
$ts = $ts ? now()->parse($ts)->timestamp : microtime(true);
|
|
return ((round($ts * 1000) - 1549756800000) << 22)
|
|
| (1 << 17)
|
|
| (1 << 12)
|
|
| 0;
|
|
}
|
|
|
|
} |