1. UNIX - C - gettimeofday function
I'm new to UNIX and C and am having difficulty with the gettimeofday
function. I understand that a time structure and time zone structure are
created and then a pointer is assigned them. These pointers are then
passed into the function, the function "loaded" the pointer location with
the appropriate data and then control is passed to the program that called
it. (did I get this much right?) The folowing is my code and the output
it produces. I'm doing several things in this code to assist me in
understanding the C language. Here is the code:
int var1 = 11;
int var2 = 22;
int var3 = 33;
struct timeval *tp;
struct timezone *tpz;
printf("var1 is: %d.\n", &var1);
printf("var2 is: %d.\n", &var2);
printf("var3 is: %d.\n", &var3);
printf("&tp is: %d.\n", &tp);
printf("&tpz is: %d.\n", &tpz);
printf("&tp->tv_sec is: %d.\n", &tp->tv_sec);
printf("&tp->tv_usec is: %d.\n", &tp->tv_usec);
printf("tp is: %i.\n", tp);
printf("tpz is: %i.\n", tpz);
printf("tp->tv_sec is: %i.\n", tp->tv_sec);
printf("*tp is: %i.\n", *tp);
printf("*tpz is: %i.\n", *tpz);
The output is produces is as follows:
var1 is: 67108016.
var2 is: 67108012.
var3 is: 67108008.
&tp is: 67108004.
&tpz is: 67108000.
&tp->tv_sec is: 84531170.
&tp->tv_usec is: 84531174.
tp is: 84531170.
tpz is: 65820.
tp->tv_sec is: 1835100526.
*tp is: 1835100526.
*tpz is: 0.
My understanding is that I was supposed to get "time of day in seconds"
passed since 1-1-97, which I calculated to be about 852,000,000 seconds. I
don't see that showing up here at all. What am I doing wrong?? I would
really appreciate it if someone could help. Thanks, Chuck Hekman.
2. PLIP driver for Windoze 95?
3. gettimeofday function
4. Apache 1.3.3 & Servlet: Strange Timeout?
5. Problem linking to gettimeofday function
6. Dynamic libraries and parameters
7. Problem with gettimeofday() function
8. 2 in 1 different BIND responses for internal and external networks
9. standard C gettimeofday function
10. gettimeofday(struct timeval *tp) but is in 2.4 gettimeofday(tp,tzp)
11. How to use "gettimeofday" function
12. gettimeofday system function giving bad system call coredump
13. function, function...who's got the function?