[comp.lang.c] the right time?

sl195102@silver.ucs.indiana.edu (01/25/90)

I am realativley new to the C language, and I am having a problem with a
program that I am currently working on.  Most of the big problems have been
ironed out with the help of a lot of C manuals, etc.  But I am still having
trouble with the time function.

Could someone send me a peice of sample code that will show how many hours
it is after midnight, in either string or long form.  I'm pulling my hair
out trying to get the right syntax, but I have only managed to get it to
display that it is Wednesday...no matter what day it really is.

Thanks,

Dave Breece

yahoo@unix.cis.pitt.edu (Kenneth L Moore) (01/25/90)

In article <9600004@silver> sl195102@silver.ucs.indiana.edu writes:

=>But I am still having
=>trouble with the time function.

=>Could someone send me a peice of sample code that will show how many hours
=>it is after midnight, in either string or long form. 

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

main()
{
   long timeofday;

   timeofday = time(0);
   printf("\n Time and date of program run: \n %s\n",ctime(&timeofday));

}
-- 
I don't yell and I don't tell and I'm grateful as hell: Benny Hill