always enable tokio/time feature
Hi, when I'm implementing a custom server, it uses tokio::time::timeout
to achieve a socket read timeout(sorry that I can't provide a full example):
loop {
if let Err(_) = timeout(std::time::Duration::from_secs(3), socket.read_exact(&mut buf)).await
{
continue;
};
}
Then my server panic with the following message:
thread 'main' panicked at /tmp/server.rs
A Tokio 1.x context was found, but timers are disabled. Call `enable_time` on the runtime builder to enable timers.
After looking into source code, I think it'd be good to introduce a tokio-time
feature which enable_time
on runtime, this mr is trying to add the feature :-)