# Set SECONDS to number of seconds since midnight. export SECONDS="$(date '+3600*%H+60*%M+%S')" # The following variables store hours and minutes. typeset -Z2 _h _m # Two columns, leading zeros. # The following expression reformats SECONDS. _time='$((_h=(SECONDS/3600)%24)):$((_m=(SECONDS/60)%60))' # Use _time within PS1 to get the time of day. PS1="($_time)"'!$ ' # Note that $_time gets replaced by above expression. # Expression gets evaluated when PS1 is displayed.