ts-7000
[Top] [All Lists]

[ts-7000] TS-Linux difftime

To:
Subject: [ts-7000] TS-Linux difftime
From: Joel Morgan <>
Date: Mon, 5 Dec 2011 06:29:45 -0600



On Dec 4, 2011 9:41 PM, "Mike Dodd" <> wrote:
>
>  
>
> 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?

I have difftime() working under TS-Linux on a 7260. The timing seems to be off a little but I haven't investigated it yet. Gnu libc manual says that time_t is just a double and you can subtract your two values. difftime() is supposed to the be more portable though.

Regards,
Joel



__._,_.___


Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: =Email Delivery: Digest | m("yahoogroups.com?subject","ts-7000-fullfeatured");=Change Delivery Format: Fully Featured">Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | =Unsubscribe

__,_._,___
<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU