|
@@ -29,6 +29,7 @@ extern crate zmq; |
|
|
#[cfg(feature = "latency")] |
|
|
#[cfg(feature = "latency")] |
|
|
extern crate pubsub as pub_sub; |
|
|
extern crate pubsub as pub_sub; |
|
|
|
|
|
|
|
|
|
|
|
use std::time::Duration; |
|
|
use chrono::{DateTime, Utc, TimeZone as ChronoTZ}; |
|
|
use chrono::{DateTime, Utc, TimeZone as ChronoTZ}; |
|
|
#[allow(unused_imports)] |
|
|
#[allow(unused_imports)] |
|
|
use sloggers::Build; |
|
|
use sloggers::Build; |
|
@@ -66,6 +67,11 @@ pub fn nanos(t: DateTime<Utc>) -> u64 { |
|
|
(t.timestamp() as u64) * 1_000_000_000_u64 + (t.timestamp_subsec_nanos() as u64) |
|
|
(t.timestamp() as u64) * 1_000_000_000_u64 + (t.timestamp_subsec_nanos() as u64) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#[inline] |
|
|
|
|
|
pub fn secs(d: Duration) -> f64 { |
|
|
|
|
|
d.as_secs() as f64 + d.subsec_nanos() as f64 / 1_000_000_000_f64 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
#[inline] |
|
|
#[inline] |
|
|
pub fn inanos(t: DateTime<Utc>) -> i64 { |
|
|
pub fn inanos(t: DateTime<Utc>) -> i64 { |
|
|
t.timestamp() * 1_000_000_000i64 + t.timestamp_subsec_nanos() as i64 |
|
|
t.timestamp() * 1_000_000_000i64 + t.timestamp_subsec_nanos() as i64 |
|
|