Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

To pretty print the Unix timestamp in your ZSH prompt, you can use something like this:

   function prompt_epoch() {
     printf -v COMMA_EPOCH "%'d" ${EPOCHSECONDS}
     p10k segment -f 66 -t ${COMMA_EPOCH}
   }
It relies on zmodload zsh/datetime to get EPOCHSECONDS. In the example above I'm using it with the powerlevel10k prompt.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: