WP has its function to get the current time

time() <=> current_time(  'timestamp' );