Hacker News new | ask | show | jobs
by lozf 3197 days ago
Recently I needed results that included nothing after the decimal point, so resorted to awk to do the math:

   awk "BEGIN { print int($SECONDS /60 /60)}"
1 comments

Interesting. I suppose you had to type Ctrl-D or Ctrl-Z to signal no input to awk, since it expects some in the above command? Never tried running awk without either a filename as input or stdin coming from a file or a pipe. Will check it and see what happens.

Modifying my example from above:

echo "scale=0; $SECONDS / 60 / 60" | bc

might also work, need to check.