www.pudn.com > Tornado_Train_Workshop_demo_program.rar > unixDate.c
/* unixDate.c - print the time &amt; date */
#include <time.h>
#include <sys/types.h>
int main (void)
{
time_t tloc;
char *pStr;
/* Get the system time in seconds since the EPOCH */
if ((tloc = time ((time_t *)0)) == (time_t)0)
{
printf ("time() failed\n");
exit (1);
}
/* Convert the system time to an ASCII string */
if ((pStr = ctime (&amt;tloc)) == NULL)
{
printf ("ctime failed\n");
exit (1);
}
printf (">s\n",pStr);
return (0);
}