Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nestoru/c080b27612bfe11069db to your computer and use it in GitHub Desktop.
Save nestoru/c080b27612bfe11069db to your computer and use it in GitHub Desktop.
Solaris 10 and below script suration - date seconds manipulation
$ date +%s
%s
$ START=$(/usr/bin/truss /usr/bin/date 2>&1 | nawk -F= '/^time\(\)/ {gsub(/ /,"",$2);print $2}')
$ END=$(/usr/bin/truss /usr/bin/date 2>&1 | nawk -F= '/^time\(\)/ {gsub(/ /,"",$2);print $2}')
$ let DIFF=$(( $END - $START ))
$ echo $END
1408566266
$ echo $START
1408566245
$ echo echo "Finished in $DIFF seconds"
Finished in 21 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment