<p>The amount of time a slot represents can be changed. This means if I code a smart contract that has some sort of waiting function for N slots, the amount of time it waits for will change with the slot time.</p>
<p>How do I write my code to be independent of the slot time, and avoid this problem?</p>

CC BY-SA 4.0
2022-03-14T11:00:42.097Z
Can you explain the use case? A `Contract` has access to all the worlds resources, so you can access the slot config, and compute it that way with [a function](https://github.com/input-output-hk/plutus-apps/blob/d637b1916522e4ec20b719487a8a2e066937aceb/plutus-ledger/src/Ledger/TimeSlot.hs#L101). Onchain scripts use POSIX time.
waalge
CC BY-SA 4.0
2022-03-14T19:52:02.260Z
I am just asking the question to build out the Cardano docs with things I thought new devs would need in the future. I was going to answer this myself, but if you could explain the conversions and some best practices I can accept the answer and upvote it. The use case - I don't actually have one, its not a problem I'm facing.
KryptoKing
<plutus><smart-contract><slottime><posixtime>
How to Ensure Constant Timing in Contracts Given Slots can be Changed?
# How to Ensure Constant Timing in Contracts Given Slots can be Changed?

(Asked by: username_0 on 2022-03-11)

The amount of time a slot represents can be changed. This means if I code a smart contract that has some sort of waiting function for N slots, the amount of time it waits for will change with the slot time.

How do I write my code to be independent of the slot time, and avoid this problem?

**Tags:** plutus, smart-contract, slottime, posixtime
> **Comments:**
> **username_1**: Can you explain the use case? A `Contract` has access to all the worlds resources, so you can access the slot config, and compute it that way with [a function](https://github.com/input-output-hk/plutus-apps/blob/d637b1916522e4ec20b719487a8a2e066937aceb/plutus-ledger/src/Ledger/TimeSlot.hs#L101). Onchain scripts use POSIX time.  
> **username_0**: I am just asking the question to build out the Cardano docs with things I thought new devs would need in the future. I was going to answer this myself, but if you could explain the conversions and some best practices I can accept the answer and upvote it. The use case - I don't actually have one, its not a problem I'm facing.  

---

## 0 answers

