[time-nuts] Anyone know a portable way of getting seconds since epoch?

Hal Murray hmurray at megapathdsl.net
Tue Oct 13 21:40:31 UTC 2009

> > On FreeBSD you can use the strftime facility in date(1):
>>        $ date +%s
>>        1255442977
>> Poul-Henning

> But it does not work on Solaris or HP-UX

I have an old Linux system.  The man page for date says:
       %s     seconds  since  `00:00:00  1970-01-01  UTC'  (a GNU
GNU sh-utils 2.0.11        October 2000

The man page on a newer Linux system doesn't have the GNU extension comment.

I was assuming it had been picked up by POSIX but I don't keep track of that 
sort of thing nor do I know where to look for the fine print.

These are my opinions, not necessarily my employer's.  I hate spam.

More information about the time-nuts mailing list