Skip to main content

Mit Windows waer das nicht passiert

Uh, Solaris, you stubborn beast:

$ date +%s
%s
No, implementing yet another switch to display a timestamp in seconds since epoch like the GNU or BSD tools do, would be too easy, now would it? Someone on the net even suggested this hack, which is kinda cool, but it still hurts my eyes so badly:
$ truss date 2>&1 | awk '/^time\(\)/ {print $3}'
1226293860
Maybe I should just go with:
$ perl -e "print time"
1226293869
....but having this one in date(1) would be nice too. Really.

Update: Malte wants to share his strace solution as well:
$ strace date 2>&1 | awk '/^clock_gettime/ {print $2}' | sed 's/[\{,]//g'

Update #2:
$ strace -ttt /bin/true 2>&1 | cut -d\. -f1 | head -1
1250491303
:-)