Use the ros-time function with no arguments. This will use the wall time if the /use_sim_time parameter is false, and the most recent value of the clock topic otherwise.
A useful macro is loop-at-most-every :
(loop-at-most-every 0.1 (publish image-pub (most-recent-image)))