Block timestamp deviation

Hi,

This is my first post (hi everyone) and my first blockchain app.
I’m developing an on-chain marketplace, coding my contracts in Rust.
Our customers need to be able to set the time range of their auctions (start / end time). I’m tempted to check the block timestamp to tell whether an auction is running (and accepting bids) when a bid transaction is mined. However, I realize this may not be entirely correct due to the way timestamps are handled in a distributed network. I want to avoid the situation where a bidder places their bid and it gets rejected even though the auction end date has obviously not come yet. Or, in other words, don’t want the auction to be shut down way too early (or too late) compared to actual time. Seconds are ok. Minutes, maybe. Hours definitely not!

So my question is: how reliable is the block timestamp as an estimate of the actual time. Or, more precisely, what’s the algorithm for verifying the block timestamp (as set by the miner), if any. If such logic is indeed applied in the block verification process what’s the allowed deviation (I’m assuming it uses the previous blocks timestamps to come up with an estimate and compare this against the validated block timestamp, as set by its miner).