[comp.lang.c] Reading system time in Xenix OS

molnar@neis.UUCP (Christopher Molnar) (02/02/91)

Hopefully someone out there has done this, I've been trying to get the 
asctime() function to work properly as its described in the Xenix
development system manuals, it won't compile it dumps the core.

Could someone please reply with a working statement, or routine, I am
trying to read in the local time as a string, and then use it in an
fprintf statement to the a log file.

Thanks in advance to anyone who can help!


Chris Molnar
 

mike (Michael Stefanik) (02/03/91)

In article <15@neis.UUCP> molnar@neis.UUCP (Christopher Molnar) writes:
>Hopefully someone out there has done this, I've been trying to get the 
>asctime() function to work properly as its described in the Xenix
>development system manuals, it won't compile it dumps the core. [...]

#include <stdio.h>
#include <time.h>

main()
{
long now;
struct tm *ptr;

	time(&now);
	ptr = localtime(&now);
	puts(asctime(ptr));
}
-- 
Michael Stefanik                       | Opinions stated are not even my own.
Systems Engineer, Briareus Corporation | UUCP: ...!uunet!bria!mike
-------------------------------------------------------------------------------
technoignorami (tek'no-ig'no-ram`i) a group of individuals that are constantly
found to be saying things like "Well, it works on my DOS machine ..."