use chrono instead of std::time
This commit is contained in:
parent
86d6f7c6a7
commit
66d4f100c6
57
Cargo.lock
generated
57
Cargo.lock
generated
@ -67,6 +67,12 @@ version = "0.2.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04"
|
checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "android-tzdata"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "android_system_properties"
|
name = "android_system_properties"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
@ -361,6 +367,20 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chrono"
|
||||||
|
version = "0.4.39"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825"
|
||||||
|
dependencies = [
|
||||||
|
"android-tzdata",
|
||||||
|
"iana-time-zone",
|
||||||
|
"js-sys",
|
||||||
|
"num-traits",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"windows-targets 0.52.6",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "codespan-reporting"
|
name = "codespan-reporting"
|
||||||
version = "0.11.1"
|
version = "0.11.1"
|
||||||
@ -781,6 +801,29 @@ version = "0.2.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iana-time-zone"
|
||||||
|
version = "0.1.61"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220"
|
||||||
|
dependencies = [
|
||||||
|
"android_system_properties",
|
||||||
|
"core-foundation-sys",
|
||||||
|
"iana-time-zone-haiku",
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"windows-core 0.52.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iana-time-zone-haiku"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "icu_collections"
|
name = "icu_collections"
|
||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
@ -2229,6 +2272,7 @@ name = "strafe-client"
|
|||||||
version = "0.10.5"
|
version = "0.10.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
|
"chrono",
|
||||||
"configparser",
|
"configparser",
|
||||||
"ddsfile",
|
"ddsfile",
|
||||||
"glam",
|
"glam",
|
||||||
@ -2892,7 +2936,7 @@ dependencies = [
|
|||||||
"web-sys",
|
"web-sys",
|
||||||
"wgpu-types",
|
"wgpu-types",
|
||||||
"windows",
|
"windows",
|
||||||
"windows-core",
|
"windows-core 0.58.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2921,7 +2965,16 @@ version = "0.58.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
|
checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-core",
|
"windows-core 0.58.0",
|
||||||
|
"windows-targets 0.52.6",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-core"
|
||||||
|
version = "0.52.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
|
||||||
|
dependencies = [
|
||||||
"windows-targets 0.52.6",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ roblox = ["dep:strafesnet_deferred_loader", "dep:strafesnet_rbx_loader"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bytemuck = { version = "1.13.1", features = ["derive"] }
|
bytemuck = { version = "1.13.1", features = ["derive"] }
|
||||||
|
chrono = "0.4.39"
|
||||||
configparser = "3.0.2"
|
configparser = "3.0.2"
|
||||||
ddsfile = "0.5.1"
|
ddsfile = "0.5.1"
|
||||||
glam = "0.29.0"
|
glam = "0.29.0"
|
||||||
|
@ -34,12 +34,12 @@ pub fn new<'a>(
|
|||||||
Instruction::Render(frame_state)=>{
|
Instruction::Render(frame_state)=>{
|
||||||
if let Some((size,user_settings))=resize.take(){
|
if let Some((size,user_settings))=resize.take(){
|
||||||
println!("Resizing to {:?}",size);
|
println!("Resizing to {:?}",size);
|
||||||
let t0=std::time::Instant::now();
|
//let t0=std::time::Instant::now();
|
||||||
config.width=size.width.max(1);
|
config.width=size.width.max(1);
|
||||||
config.height=size.height.max(1);
|
config.height=size.height.max(1);
|
||||||
surface.configure(&device,&config);
|
surface.configure(&device,&config);
|
||||||
graphics.resize(&device,&config,&user_settings);
|
graphics.resize(&device,&config,&user_settings);
|
||||||
println!("Resize took {:?}",t0.elapsed());
|
//println!("Resize took {:?}",t0.elapsed());
|
||||||
}
|
}
|
||||||
//this has to go deeper somehow
|
//this has to go deeper somehow
|
||||||
let frame=match surface.get_current_texture(){
|
let frame=match surface.get_current_texture(){
|
||||||
|
@ -215,17 +215,17 @@ pub async fn setup_and_start(title:String){
|
|||||||
};
|
};
|
||||||
|
|
||||||
println!("Entering event loop...");
|
println!("Entering event loop...");
|
||||||
let root_time=std::time::Instant::now();
|
let root_time=chrono::Utc::now();
|
||||||
run_event_loop(event_loop,window_thread,root_time).unwrap();
|
run_event_loop(event_loop,window_thread,root_time).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_event_loop(
|
fn run_event_loop(
|
||||||
event_loop:winit::event_loop::EventLoop<()>,
|
event_loop:winit::event_loop::EventLoop<()>,
|
||||||
mut window_thread:crate::compat_worker::QNWorker<TimedInstruction<WindowInstruction>>,
|
mut window_thread:crate::compat_worker::QNWorker<TimedInstruction<WindowInstruction>>,
|
||||||
root_time:std::time::Instant
|
root_time:chrono::DateTime<chrono::Utc>,
|
||||||
)->Result<(),winit::error::EventLoopError>{
|
)->Result<(),winit::error::EventLoopError>{
|
||||||
event_loop.run(move |event,elwt|{
|
event_loop.run(move |event,elwt|{
|
||||||
let time=integer::Time::from_nanos(root_time.elapsed().as_nanos() as i64);
|
let time=integer::Time::from_nanos((chrono::Utc::now()-root_time).num_nanoseconds().unwrap());
|
||||||
// *control_flow=if cfg!(feature="metal-auto-capture"){
|
// *control_flow=if cfg!(feature="metal-auto-capture"){
|
||||||
// winit::event_loop::ControlFlow::Exit
|
// winit::event_loop::ControlFlow::Exit
|
||||||
// }else{
|
// }else{
|
||||||
|
Loading…
Reference in New Issue
Block a user