Getting Unix Format Time on Solaris

Here is a little script to obtain Unix format on Solaris (Epoch Time):

1
2
3
#!/bin/sh
/usr/bin/truss /usr/bin/date 2>&1 |  nawk -F= '/^time\(\)/ {gsub(/ /,"",$2);print $2}'
exit $?

And finally, let’s see it in action:

1
2
# ./edate
1149276150

Last updated 06 Mar 2007, 16:45 +0200. history