diff --git a/server/src/commands/serve.rs b/server/src/commands/serve.rs index a5605621..5117ac28 100644 --- a/server/src/commands/serve.rs +++ b/server/src/commands/serve.rs @@ -1,6 +1,6 @@ use std::path::{Path, PathBuf}; use std::process; -use std::sync::{Arc, Mutex}; +use std::time::Instant; use rand; @@ -87,5 +87,5 @@ pub fn serve(project_path: &PathBuf, verbose: bool, port: Option) { println!("Server listening on port {}", web_config.port); - web::start(web_config, project.clone(), &PLUGIN_CHAIN, vfs.clone()); + web::start(web_config, project.clone(), Instant::now()); } diff --git a/server/src/web.rs b/server/src/web.rs index a41a10cc..be6f4667 100644 --- a/server/src/web.rs +++ b/server/src/web.rs @@ -1,10 +1,9 @@ use std::sync::{Arc, Mutex}; +use std::time::Instant; use rouille; use project::Project; -use vfs::{VfsSession}; -use middleware::MiddlewareChain; use web_util::json; /// The set of configuration the web server needs to start. @@ -25,7 +24,7 @@ struct ServerInfo<'a> { } /// Start the Rojo web server and park our current thread. -pub fn start(config: WebConfig, project: Project, _middleware_chain: &'static MiddlewareChain, vfs: Arc>) { +pub fn start(config: WebConfig, project: Project, start_time: Instant) { let address = format!("localhost:{}", config.port); let server_id = config.server_id.to_string(); @@ -36,9 +35,9 @@ pub fn start(config: WebConfig, project: Project, _middleware_chain: &'static Mi // Get a summary of information about the server. let current_time = { - let vfs = vfs.lock().unwrap(); + let elapsed = start_time.elapsed(); - vfs.current_time() + elapsed.as_secs() as f64 + elapsed.subsec_nanos() as f64 / 1_000_000_000.0 }; json(ServerInfo {