How to create a time window in solidity .. so that you will allow a function call for example with in 2 hours .. I know timers do not exist in solidity so how do I only allow a function to be called within a certain period of time
There are two methods: Either you estimate the the block number of the beginning and end of your period, and do
require (block.number < ##yourStartBlock## && blocknumber < ##yourEndBlock##)
or you use block.timestamp, where an integer represents the unix time stamp of the block. This is only as precise as the miner wants it to be, meaning block.timestamp can turn out to be anything between the block.timestamp of the last and the next block.
require (block.timestamp < 1521379216 && block.timestamp < 1521343200)
1521379216 == 03/18/2018 @ 1:20pm (UTC)
1521343200 == 03/18/2018 @ 3:20am (UTC)