Is this what you mean when you say "smart contract itself to get the current time"?
#[program]mod hello_anchor { use super::*; pub fn initialize(ctx: Context<Initialize>) -> Result<()> { let clock = Clock::get().unwrap(); msg!("Timestamp: {}!", clock.unix_timestamp); // Message will show up in the tx logs Ok(()) }}#[derive(Accounts)]pub struct Initialize {}
The program log will look like this