|
@@ -58,10 +58,16 @@ const CHANNEL_SIZE: usize = 2_097_152; |
|
|
|
|
|
|
|
|
/// converts a chrono::DateTime to an integer timestamp (ns) |
|
|
/// converts a chrono::DateTime to an integer timestamp (ns) |
|
|
/// |
|
|
/// |
|
|
|
|
|
#[inline] |
|
|
pub fn nanos(t: DateTime<Utc>) -> u64 { |
|
|
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 inanos(t: DateTime<Utc>) -> i64 { |
|
|
|
|
|
t.timestamp() * 1_000_000_000i64 + t.timestamp_subsec_nanos() as i64 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//#[cfg(not(any(test, feature = "test")))] |
|
|
//#[cfg(not(any(test, feature = "test")))] |
|
|
pub fn file_logger(path: &str, level: Severity) -> slog::Logger { |
|
|
pub fn file_logger(path: &str, level: Severity) -> slog::Logger { |
|
|
let mut builder = FileLoggerBuilder::new(path); |
|
|
let mut builder = FileLoggerBuilder::new(path); |
|
@@ -91,6 +97,7 @@ pub fn async_file_logger(path: &str, level: Severity) -> slog::Logger { |
|
|
slog::Logger::root(async_drain.fuse(), o!()) |
|
|
slog::Logger::root(async_drain.fuse(), o!()) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//#[deprecated(since="0.4.3", note="Use `nanos(DateTime<Utc>) -> u64` instead")] |
|
|
pub fn dt_nanos(t: DateTime<Utc>) -> i64 { |
|
|
pub fn dt_nanos(t: DateTime<Utc>) -> i64 { |
|
|
(t.timestamp() as i64) * 1_000_000_000_i64 + (t.timestamp_subsec_nanos() as i64) |
|
|
(t.timestamp() as i64) * 1_000_000_000_i64 + (t.timestamp_subsec_nanos() as i64) |
|
|
} |
|
|
} |
|
|