user725: Is it possible for a validator to get the current time without it being passed in via the redeemer? My validator is heavily dependent on the time being correct so it would probably be a bad design choice to allow the wallet to pass in the time, as it can lie about the current time.

user255: How about parameterizing the validator with Slot or POSIXTime and passing the current time from the contract to the validator script using Contract.currentTime or Contract.currentSlot?
That way, the wallet has no influence on it.

user4422: The usual way to handle time in Plutus is using Slot ranges. This means that the script does not query the time. Instead it checks that the validation happens in a given slot interval that corresponds to a time.
You can have a look at the notes about slots from the Plutus Pioneers Course.
With these slots, you can ensure that the validation takes place before, after or in a certain slot interval. And when you are sure that the validation takes place in a specific time interval, you also know the corresponding time. Each slot corresponds to one second as described here.

725: <p>Is it possible for a validator to get the current time without it being passed in via the redeemer? My validator is heavily dependent on the time being correct so it would probably be a bad design choice to allow the wallet to pass in the time, as it can lie about the current time.</p>
 255: <p>How about parameterizing the validator with <code>Slot</code> or <code>POSIXTime</code> and passing the current time from the contract to the validator script using <code>Contract.currentTime</code> or <code>Contract.currentSlot</code>?</p>
<p>That way, the wallet has no influence on it.</p>
 4422: <p>The usual way to handle time in Plutus is using Slot ranges. This means that the script does not query the time. Instead it checks that the validation happens in a given slot interval that corresponds to a time.
You can have a look at the <a href="https://docs.plutus-community.com/docs/lectures/Lecture3.html" rel="nofollow noreferrer">notes about slots</a> from the Plutus Pioneers Course.</p>
<p>With these slots, you can ensure that the validation takes place before, after or in a certain slot interval. And when you are sure that the validation takes place in a specific time interval, you also know the corresponding time. Each slot corresponds to one second as described <a href="https://docs.cardano.org/new-to-cardano/cardano-nodes#howdoesitwork?" rel="nofollow noreferrer">here</a>.</p>
