J
Jim Showalter
I want to get the current date/time using time(), then use ctime() to
display it.
What type is time_t? I've tried looking it up in time.h and elsewhere.
"grep" shows: typedef __time_t time_t;
which, in turn, greps as: __time_t tv_sec;
Here's my latest attempt:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int
main (void)
{
time_t eot, *tod;
eot = time(tod);
printf("*tod\t = %ul\n", *tod);
printf("Today's date is: %s\n", ctime(tod));
return EXIT_SUCCESS;
}
What am I doing wrong?
Also, how can I determine the max value time_t can hold?
jim
display it.
What type is time_t? I've tried looking it up in time.h and elsewhere.
"grep" shows: typedef __time_t time_t;
which, in turn, greps as: __time_t tv_sec;
Here's my latest attempt:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int
main (void)
{
time_t eot, *tod;
eot = time(tod);
printf("*tod\t = %ul\n", *tod);
printf("Today's date is: %s\n", ctime(tod));
return EXIT_SUCCESS;
}
What am I doing wrong?
Also, how can I determine the max value time_t can hold?
jim