[H-GEN] time.h

Luke Grant humbug at term.webexpress.net.au
Sun May 31 22:38:34 EDT 1998


Hi all,
        A week or so ago i sent a mail to the list asking how to use
<time.h> functions. Anyway the topic wsa never realy resolved. I have
worked t out......not that i have spent much time on it....anyway..here is
a nice little program that lets you get access to the time structre. For
those of you who have this as seccond nature...no flaming please...for the
rest of you, hope this comes in handy sometime.......


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

void main()
{
struct tm when;
time_t now;

now = time(0);
when = *localtime(&now);
/*you know have the time structre in when*/
/* structure items are...
int tm_sec
int tm_min
int tm_hour
int tm_mday 
etc.....full description found in time.h
*/

printf("the time is %d:%d:%d\n", when.tm_hour, when.tm_min, when.tm_sec);

}

*****************************************************
To err is human, to completely stuff up is Microsoft.
*****************************************************
Luke Grant
Luke.G at uq.net.au
n2143968 at student.fit.qut.edu.au
techman at webexpress.net.au
*****************************************************



----------------------- HUMBUG General List --------------------------------
echo "unsubscribe general" | mail majordomo at humbug.org.au # To Unsubscribe



More information about the General mailing list