Skip to content
This repository has been archived by the owner on May 11, 2020. It is now read-only.

Commit

Permalink
Replace Duration::span with Instant::now().elapsed
Browse files Browse the repository at this point in the history
  • Loading branch information
acmiyaguchi committed Dec 21, 2016
1 parent fe2a666 commit dad4ff5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(duration_span)]

#[macro_use]
extern crate log;

Expand All @@ -9,7 +7,7 @@ extern crate linenoise;
extern crate llamadb;

use std::io::Write;
use std::time::Duration;
use std::time::Instant;

mod prettyselect;
use prettyselect::pretty_select;
Expand Down Expand Up @@ -82,12 +80,10 @@ fn execute_statement(out: &mut Write, db: &mut llamadb::tempdb::TempDb, statemen
{
use llamadb::tempdb::ExecuteStatementResponse;

let mut execute_result = None;
let now = Instant::now();
let execute_result = Some(db.execute_statement(statement));
let duration = now.elapsed();

let duration = Duration::span(|| {
execute_result = Some(db.execute_statement(statement));
});

let seconds = duration.as_secs() as f32 + (duration.subsec_nanos() as f32 * 1.0e-9);

let duration_string = format!("{:.3}s", seconds);
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(into_cow, associated_type_defaults)]
#![feature(associated_type_defaults)]

#[macro_use]
extern crate log;
Expand Down

0 comments on commit dad4ff5

Please sign in to comment.