From: Barry Finkel (b19141@ACHILLES.CTD.ANL.GOV)
Date: Wed Oct 01 2003 - 10:25:39 EDT
>Hello everyone,
>
>I'm looking a script for how to convert the epoch time to the
>actual date.. Anyone have any ideas?!?!?
>
>Thanks,
I got this somewhere, I think from AIX-L ages ago:
britaine% cat epoch.c
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
main(
int argc,
char *argv[]
)
{
time_t epoch;
if(argc==2)
{
epoch=atol(argv[1]);
printf(asctime(localtime(&epoch)));
}
else
{
printf("Usage: %s epochdigits\n",argv[0]);
}
}
britaine%
Compile it, and run it via
britaine% epoch.out 900613434
Thu Jul 16 13:23:54 1998
britaine%
----------------------------------------------------------------------
Barry S. Finkel
Computing and Instrumentation Solutions Division
Argonne National Laboratory Phone: +1 (630) 252-7277
9700 South Cass Avenue Facsimile:+1 (630) 252-4601
Building 222, Room D209 Internet: BSFinkel@anl.gov
Argonne, IL 60439-4828 IBMMAIL: I1004994
This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:15 EDT