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

Javier Herrero jherrero at hvsistemas.es
Tue Oct 13 20:20:32 UTC 2009


Poul-Henning Kamp escribió:
> In message <286f7bad0910130703v6680affbx95905a440000099f at mail.gmail.com>, David
>  Kirkby writes:
>> I've asked this on comp.unix.shell, but never got a 100% satsifactory
>> answer. Perhaps someone here might know.
>>
>> Does anyone know how to get the number of seconds since 1/1/1970 on a
>> Unix system using the shell - not compiling C code. I can't assume the
>> computer has perl, python or a C compiler.
>
> On FreeBSD you can use the strftime facility in date(1):
>
> 	$ date +%s
> 	1255442977
>
> Poul-Henning
>
And same works for linux, too

Regards,

Javier

-- 
------------------------------------------------------------------------
Javier Herrero                            EMAIL: jherrero at hvsistemas.com
HV Sistemas S.L.                          PHONE:         +34 949 336 806
Los Charcones, 17A                        FAX:           +34 949 336 792
19170 El Casar - Guadalajara - Spain      WEB: http://www.hvsistemas.com




More information about the time-nuts mailing list