From c0076ab035afbf3764bac0eaf7155157db253b47 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 12 Jan 2021 21:50:45 -0700 Subject: [PATCH] Add snowflake id service --- app/Services/SnowflakeService.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 app/Services/SnowflakeService.php diff --git a/app/Services/SnowflakeService.php b/app/Services/SnowflakeService.php new file mode 100644 index 000000000..b04c56b40 --- /dev/null +++ b/app/Services/SnowflakeService.php @@ -0,0 +1,18 @@ +parse($ts)->timestamp : microtime(true); + return ((round($ts * 1000) - 1549756800000) << 22) + | (1 << 17) + | (1 << 12) + | 0; + } + +} \ No newline at end of file