1834018 Members
2236 Online
110063 Solutions
New Discussion

Re: Epoch Time

 
Martin Schilk
New Member

Epoch Time

Does anyone know of a unix command (or perl scrip) that converts an epoch time into unix time?

Thanks,
Martin
3 REPLIES 3
Marcin Wicinski
Trusted Contributor

Re: Epoch Time

Hi,


Following script converts epoch time into human (real) time. If "unix time" you mention means real time, that's it:

#include
main(argc, argv)

int argc;
char **argv;
{
time_t foo;
foo = atoi(argv[1]);
printf("%s",ctime(&foo));
}

Good luck,
Marcin Wicinski
Robin Wakefield
Honored Contributor

Re: Epoch Time

Create a script as follows:

#!/usr/bin/perl (or whatever)
print scalar localtime($ARGV[0]),"\n";

then you'll get:

$ script 994841017
Wed Jul 11 09:43:37 2001
$

Robin.
Bruno DESQUESNE
Advisor

Re: Epoch Time

just a quick contribution to mention

timelocal, a perl function to convert date/time in epoch... always useful to compare dates.

Regards