Rus*_*sso 3 unix-timestamp rust blockchain solana
我知道如何从前端传递当前的 Unix 时间:
web3.js:
anchor.web3.SYSVAR_CLOCK_PUBKEY
Run Code Online (Sandbox Code Playgroud)
锈:
let current_time = ctx.accounts.clock.unix_timestamp;
Run Code Online (Sandbox Code Playgroud)
我不要那个。我需要智能合约本身来获取当前时间。
我假设你正在使用锚点
let now_ts = Clock::get().unwrap().unix_timestamp;
Run Code Online (Sandbox Code Playgroud)
您需要传入系统程序帐户