www.pudn.com > Tornado_Train_Workshop_demo_program.rar > unixDate.c


/* unixDate.c - print the time & date */ 
 
#include  
#include  
 
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 (&tloc)) == NULL) 
	{ 
	printf ("ctime failed\n"); 
        exit (1); 
        } 
 
    printf ("%s\n",pStr); 
 
    return (0); 
    }