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

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Δοκιμές βάσει χρόνου

> Δοκιμάστε λειτουργίες που εξαρτώνται από slots ή χρονικές σημάνσεις

## Επισκόπηση

Αυτό το παράδειγμα δείχνει πώς να δοκιμάσετε λειτουργίες που εξαρτώνται από τον χρόνο, χειριζόμενοι slots και
χρονικές σημάνσεις στο LiteSVM.

## Πλήρης δοκιμή

```rust tests/time_test.rs
use litesvm::LiteSVM;
use solana_sdk::clock::Clock;

#[test]
fn test_time_locked_feature() {
    let mut svm = LiteSVM::new();

    // Get current time
    let clock: Clock = svm.get_sysvar();
    println!("Starting slot: {}", clock.slot);
    println!("Starting timestamp: {}", clock.unix_timestamp);

    // Test something at current time
    // ... your test logic ...

    // Jump forward 100 slots
    svm.warp_to_slot(clock.slot + 100);

    // Verify time changed
    let new_clock: Clock = svm.get_sysvar();
    assert_eq!(new_clock.slot, clock.slot + 100);

    // Test time-locked feature is now available
    // ... your test logic ...

    println!("Time travel successful!");
}
```

## Δοκιμή λειτουργιών βασισμένων σε slots

```rust
#[test]
fn test_slot_based_unlock() {
    let mut svm = LiteSVM::new();

    // Get starting slot
    let start_slot = svm.get_sysvar::<Clock>().slot;

    // Deploy program with slot-based lock
    let program_id = deploy_locked_program(&mut svm);

    // Try to call before unlock slot (should fail)
    let result = call_program(&mut svm, program_id);
    assert!(result.is_err());

    // Warp to unlock slot
    svm.warp_to_slot(start_slot + 1000);

    // Now it should succeed
    let result = call_program(&mut svm, program_id);
    assert!(result.is_ok());
}
```

## Δοκιμή λειτουργιών βασισμένων σε χρονικές σημάνσεις

```rust
#[test]
fn test_timestamp_based_feature() {
    let mut svm = LiteSVM::new();

    // Get current timestamp
    let clock: Clock = svm.get_sysvar();
    let current_time = clock.unix_timestamp;

    // Warp forward 1 hour (3600 seconds)
    let target_slot = clock.slot + (3600.0 / 0.2) as u64; // ~0.2s per slot on mainnet

    // `warp_to_slot` only moves the slot, so set the timestamp yourself
    let mut warped: Clock = svm.get_sysvar();
    warped.slot = target_slot;
    warped.unix_timestamp = current_time + 3600;
    svm.set_sysvar(&warped);

    // Verify timestamp increased
    let new_clock: Clock = svm.get_sysvar();
    assert!(new_clock.unix_timestamp >= current_time + 3600);
}
```

## Βασικά σημεία

1. **Clock Sysvar**: Χρησιμοποιήστε το `svm.get_sysvar::<Clock>()` για να λάβετε την τρέχουσα ώρα
2. **Slot Warping**: Χρησιμοποιήστε το `warp_to_slot()` για να μεταβείτε μπροστά σε slots. Ενημερώνει
   μόνο το `Clock.slot`, όχι τη χρονική σήμανση ή το epoch
3. **Υπολογισμός χρονικής σήμανσης**: Τα slots του Mainnet στοχεύουν στα 200ms (0,2 δευτερόλεπτα). Ορίστε
   το `unix_timestamp` χειροκίνητα όταν δοκιμάζετε λογική χρονικής σήμανσης
4. **Δοκιμή ξεκλειδώματος**: Δοκιμάστε λειτουργίες με χρονικό κλείδωμα μεταβαίνοντας πέρα από τον χρόνο
   ξεκλειδώματος
5. **Μόνο προς τα εμπρός κατά σύμβαση**: Μεταβαίνετε προς τα εμπρός· το LiteSVM δεν απορρίπτει
   μεταβάσεις προς τα πίσω

## Συνήθεις περιπτώσεις χρήσης

- Χρονοδιαγράμματα vesting
- Αναλήψεις με χρονικό κλείδωμα
- Περίοδοι cooldown για stake/unstake
- Χρόνοι λήξης δημοπρασιών
- Περίοδοι ενοικίασης
