Remove usage of unstable library feature 'duration'

This commit is contained in:
Gwenael Treguier 2015-08-02 12:16:01 +02:00
parent ef254fdca0
commit 9c415f9c9e
2 changed files with 4 additions and 7 deletions

View File

@ -50,7 +50,6 @@
//! }
//! }
//! ```
#![cfg_attr(test, feature(duration))]
extern crate libc;
extern crate libsqlite3_sys as ffi;
#[macro_use] extern crate bitflags;

View File

@ -80,19 +80,17 @@ mod test {
super::config_log(None).unwrap();
}
extern "C" fn profile_callback(_: *mut ::libc::c_void, sql: *const ::libc::c_char, nanoseconds: u64) {
use std::time::Duration;
extern "C" fn trace_callback(_: *mut ::libc::c_void, sql: *const ::libc::c_char) {
unsafe {
let c_slice = ::std::ffi::CStr::from_ptr(sql).to_bytes();
let d = Duration::from_millis(nanoseconds / 1_000_000);
let _ = writeln!(::std::io::stderr(), "PROFILE: {:?} ({})", ::std::str::from_utf8(c_slice), d);
let _ = writeln!(::std::io::stderr(), "TRACE: {:?}", ::std::str::from_utf8(c_slice));
}
}
#[test]
fn test_profile() {
fn test_trace() {
let mut db = SqliteConnection::open_in_memory().unwrap();
db.profile(Some(profile_callback));
db.trace(Some(trace_callback));
db.execute_batch("PRAGMA application_id = 1").unwrap();
}
}