cloud_util/
lib.rs

1// Copyright Rivtower Technologies LLC.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15pub mod common;
16pub mod crypto;
17pub mod graceful_shutdown;
18pub mod metrics;
19pub mod network;
20pub mod panic_hook;
21#[cfg(not(windows))]
22pub mod signal;
23pub mod storage;
24pub mod tracer;
25
26#[macro_use]
27extern crate tracing as logger;
28
29pub fn unix_now() -> u64 {
30    let d = ::std::time::UNIX_EPOCH.elapsed().unwrap();
31    d.as_secs() * 1_000 + u64::from(d.subsec_millis())
32}
33
34pub fn clean_0x(s: &str) -> &str {
35    if let Some(stripped) = s.strip_prefix("0x") {
36        stripped
37    } else {
38        s
39    }
40}