开发者

How to print the number of seconds since unix epoch in solaris shell

Is there a way to use unix date to print the number of seconds since epoch?

I'm open to using other standard shell commands if there is a way

(I'm using Solaris, so there i开发者_如何学编程sn't date "+"%s")

Thanks


perl -e 'print time'


Well, since this is a programming site, I would just compile something like:

#include <stdio.h>
#include <time.h>
int main (void) {
    printf ("%d\n",time(0));
    return 0;
}

:-)


you can try nawk,(but try to double confirm with the perl commands and see if they give the same results)

nawk "BEGIN{print srand}"


Try this

/usr/bin/truss /usr/bin/date 2>&1 | grep ^time | awk '{print $3}'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜