Move tokio_kcp to local files

This commit is contained in:
KernelErr
2021-10-26 23:02:05 +08:00
parent bfce455a7e
commit a88a263d20
15 changed files with 1010 additions and 19 deletions

10
src/plugins/kcp/utils.rs Normal file
View File

@ -0,0 +1,10 @@
use std::time::{SystemTime, UNIX_EPOCH};
#[inline]
pub fn now_millis() -> u32 {
let start = SystemTime::now();
let since_the_epoch = start
.duration_since(UNIX_EPOCH)
.expect("time went afterwards");
(since_the_epoch.as_secs() * 1000 + since_the_epoch.subsec_millis() as u64 / 1_000_000) as u32
}