www.pudn.com > vxWorks_Lab.rar > unixTimeServer.c


/* unixTimeServer.c - example RPC server code */ 
 
#include  
#include  
#include  
#include "time.h" 
 
#define NULL					0 
 
char ** print_time_1 (void) 
	{ 
	time_t tloc; 
	static char * pStr; 
 
	/* Get system time in seconds since the EPOCH */ 
 
	if ((tloc = time ((time_t *)0)) == (time_t)(-1)) 
		{ 
		printf ("time() failed\n"); 
		return (NULL); 
		} 
 
	/* Convert the system time to an ASCII string */ 
 
	if ((pStr = ctime (&tloc)) == NULL) 
		{ 
		printf ("ctime failed\n"); 
		return (NULL); 
		} 
 
	return (&pStr); 
	}