I wrote a C program that compiles and runs on a TS-7250
under Debian and
under TS-Linux, but difftime() doesn't operate correctly
under TS-Linux.
Here is a test program:
---------------
struct tm *tp = NULL;
time_t t_now;
time_t t_last;
double elapsed_seconds;
t_last = time(NULL);
while(1)
{
t_now = time(NULL);
elapsed_seconds = difftime(t_now, t_last); // Get time
through loop
t_last = t_now;
printf("t_now = %ld, t_last = %ld\n", t_now, t_last);
printf("elapsed_seconds = %1.1f\n", elapsed_seconds);
sleep(5);
}
---------------
Under Debian, I see the expected 5 seconds for
elapsed_seconds each time
through the loop. But under TS-Linux, elapsed_seconds is
always ZERO.
The t_last and t_now variables are being updated correctly
-- 5 seconds
difference each time -- but the TS-Linux difftime ()
returns zero.
This is the exact-same code running on Debian and
TS-Linux.
Anyone know what's going on?
Thanks for any pointers.
--
Mike
Mike Dodd
Louisa County, VA USA
http://mdodd.com