Search code examples
unixdatesolaris

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 isn't date "+"%s")

Thanks


Solution

  • 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;
    }
    

    :-)