> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tenderly.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Virtual Environments पर timestamps के साथ काम करना

> जानें कि आप Virtual Environments पर सही timestamp कैसे access कर सकते हैं और time को कैसे आगे बढ़ा सकते हैं

कुछ प्रकार के tests के लिए time के माध्यम से skip करना उपयोगी है। यह Virtual Environments पर उपलब्ध 2 Admin RPC methods पर निर्भर करके संभव है: **[`evm_setNextBlockTimestamp`](/virtual-environments/admin-rpc/#evm_setnextblocktimestamp)** और **[`evm_setNextBlockTimestamp`](/virtual-environments/admin-rpc/#evm_setnextblocktimestamp)**।

## सही समय प्राप्त करना

एक transaction या `eth_call` के execution के दौरान एक contract के अंदर `block.timestamp` को access किया जाता है, तो value इस पर निर्भर करेगी कि target block (`latest` या `pending`) block है या नहीं:

* **`pending` block के लिए**: `block.timestamp == time.now() + adjustment_offset`। यह time-adjustment methods द्वारा adjusted current time को दर्शाता है।
* **`latest` block के लिए**: `block.timestamp == latest_block.timestamp`। यह सबसे हाल ही में mined block का timestamp है।

`adjustment_offset` time-adjustment methods से आता है:

1. [`evm_setNextBlockTimestamp`](/virtual-environments/admin-rpc/#evm_setnextblocktimestamp):
   अगले block के लिए timestamp पर time को skip करता है: `adjustment_offset = timestamp - time.now()`।

2. [`evm_increaseTime`](/virtual-environments/admin-rpc/#evm_increasetime):
   time को एक relative amount से आगे बढ़ाता है।
   `adjustment_offset += increase_value`

## उदाहरण

### एक offset से time बढ़ाएं

```bash showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
VIRTUAL_TESTNET_RPC=https://YOUR-RPC-URL-HERE
curl -s -X POST \
  -H "Content-Type: application/json" \
  --data '{
    "jsonrpc": "2.0",
    "method": "evm_increaseTime",
    "params": ["0xe10"],
    "id": 2
  }' "$VIRTUAL_TESTNET_RPC"
```

### pending block के लिए timestamp सेट करें

```bash showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
VIRTUAL_TESTNET_RPC=https://YOUR-RPC-URL-HERE

# Get the current date in Unix timestamp format
current_date=$(date +%s)

# Use evm_setTime to set the block time to today (current timestamp)
curl -s -X POST \
  -H "Content-Type: application/json" \
  --data '{
    "jsonrpc": "2.0",
    "method": "evm_setNextBlockTimestamp",
    "params": ["'"$current_date"'"],
    "id": 3
  }' "$VIRTUAL_TESTNET_RPC"
```
