-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented Twitter's Snowflake ID generation and parsing funcs
- Loading branch information
1 parent
cbaec1d
commit 7087dfc
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
// Copyright (C) Wasym A. Alonso. All Rights Reserved. | ||
|
||
#include <carbon.h> | ||
|
||
CARBON_TEST(carbon_time, snowflake) { | ||
CBN_SnowflakeComponents cmps = carbon_time_snowflake_parse(1160192133117220889); | ||
carbon_should_be_u64(1733452918, cmps.timestamp); | ||
carbon_should_be_u64(2594841, cmps.random); | ||
return CARBON_OK; | ||
} |