Skip to main content
edited body
Source Link
Ander
  • 1k
  • 4
  • 18

Seems like there are two ways of retrieving Clock according Solana docs:

  1. Passing SYSVAR_CLOCK_PUBKEY into an instruction

    let clock = Clock::from_account_info(&sysvar_clock_pubkey)?;
    let current_timestamp = clock.unix_timestamp;
    
  2. Accessing Clock directly inside an instruction.

    let clock = Clock::get()?;
    let current_timestamp = clock.unix_timestamp;
    

SeemsLooks like we shouldn't use external libs for this.

Seems like there are two ways of retrieving Clock according Solana docs:

  1. Passing SYSVAR_CLOCK_PUBKEY into an instruction

    let clock = Clock::from_account_info(&sysvar_clock_pubkey)?;
    let current_timestamp = clock.unix_timestamp;
    
  2. Accessing Clock directly inside an instruction.

    let clock = Clock::get()?;
    let current_timestamp = clock.unix_timestamp;
    

Seems like we shouldn't use external libs for this.

Seems like there are two ways of retrieving Clock according Solana docs:

  1. Passing SYSVAR_CLOCK_PUBKEY into an instruction

    let clock = Clock::from_account_info(&sysvar_clock_pubkey)?;
    let current_timestamp = clock.unix_timestamp;
    
  2. Accessing Clock directly inside an instruction.

    let clock = Clock::get()?;
    let current_timestamp = clock.unix_timestamp;
    

Looks like we shouldn't use external libs for this.

Source Link
Ander
  • 1k
  • 4
  • 18

Seems like there are two ways of retrieving Clock according Solana docs:

  1. Passing SYSVAR_CLOCK_PUBKEY into an instruction

    let clock = Clock::from_account_info(&sysvar_clock_pubkey)?;
    let current_timestamp = clock.unix_timestamp;
    
  2. Accessing Clock directly inside an instruction.

    let clock = Clock::get()?;
    let current_timestamp = clock.unix_timestamp;
    

Seems like we shouldn't use external libs for this.