The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
Scripts / handy tips
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 seconds since epoch
Author: Dan Langille 
Date:   24-01-02 01:44

I always have trouble remembering this one:

$ date +%s
1011825117

$ perl -le 'print time'
1011826485

and if you need to: http://www.cs.uleth.ca/~holzmann/C/system/seconds_since_epoch.c

And I'd like one that works on Solaris!


Reply To This Message
 
 Re: seconds since epoch
Author: Jonathan 
Date:   13-03-02 18:24

This for Solaris 8:

/usr/bin/perl -e 'printf "%d\n", time;'

Or for 2.6/7 (untested):

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

Hope that helps, Dan!

- Jonathan

Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org