-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Misskey 2023.11.0-beta.4 compatible (only aid)
misskey-dev/misskey@1fa1d31 F-word.
- Loading branch information
1 parent
e599598
commit 773f009
Showing
6 changed files
with
63 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
"index": "undefined" | ||
}, | ||
"option": { | ||
"idtype": "aid", | ||
"localonly": false, | ||
"limit": null | ||
} | ||
|
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,13 @@ | ||
use std::time::{Duration, SystemTime}; | ||
use chrono::{DateTime, Utc}; | ||
|
||
const TIME2000: i64 = 946_684_800_000; | ||
|
||
pub(crate) fn parse(id: String) -> DateTime<Utc> { | ||
let time = i64::from_str_radix(&id[..8], 36).unwrap() + TIME2000; | ||
let system_time = SystemTime::UNIX_EPOCH | ||
.checked_add(Duration::from_millis(time as u64)) | ||
.ok_or("Failed to parse AID: Invalid Date").unwrap(); | ||
|
||
DateTime::<Utc>::from(system_time) | ||
} |
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