grpcio_sys/grpc_wrap.rs
1// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
2
3use super::*;
4
5use std::time::Duration;
6
7impl gpr_timespec {
8 pub fn inf_future() -> gpr_timespec {
9 unsafe { gpr_inf_future(gpr_clock_type::GPR_CLOCK_REALTIME) }
10 }
11}
12
13impl From<Duration> for gpr_timespec {
14 fn from(dur: Duration) -> gpr_timespec {
15 gpr_timespec {
16 tv_sec: dur.as_secs() as i64,
17 tv_nsec: dur.subsec_nanos() as i32,
18 clock_type: gpr_clock_type::GPR_TIMESPAN,
19 }
20 }
21}