[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#201664: marked as done (libc: bug in ftime)



Your message dated Fri, 08 Oct 2004 12:16:01 +0900
with message-id <818yahx5la.wl@omega.webmasters.gr.jp>
and subject line libc: bug in ftime
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 17 Jul 2003 06:16:44 +0000
>From bott@campana.vi.it Thu Jul 17 01:16:41 2003
Return-path: <bott@campana.vi.it>
Received: from ip-a1-37024.keycomm.it (sparc.campana.vi.it) [62.152.37.24] 
	by master.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 19d24G-000092-00; Thu, 17 Jul 2003 01:16:41 -0500
Received: from dirac.campana.vi.it (dirac.campana.vi.it [192.168.0.4])
	by sparc.campana.vi.it (Postfix) with ESMTP
	id 41561B9E1; Thu, 17 Jul 2003 08:16:25 +0200 (CEST)
Received: from bott by dirac.campana.vi.it with local (Exim 3.35 #1 (Debian))
	id 19d23z-0002dW-00; Thu, 17 Jul 2003 08:16:23 +0200
From: ottavio@campana.vi.it
Subject: libc: bug in ftime
To: submit@bugs.debian.org
X-Mailer: bug 3.3.10.1
Message-Id: <E19d23z-0002dW-00@dirac.campana.vi.it>
Sender: Ottavio Campana <bott@campana.vi.it>
Date: Thu, 17 Jul 2003 08:16:23 +0200
Delivered-To: submit@bugs.debian.org
X-Spam-Status: No, hits=-4.5 required=4.0
	tests=BAYES_10,HAS_PACKAGE,NO_REAL_NAME
	version=2.53-bugs.debian.org_2003_06_27
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.53-bugs.debian.org_2003_06_27 (1.174.2.15-2003-03-30-exp)

Package: libc
Version: N/A
Severity: normal

I've found a bug in libc using ftime. Give a look at this little code:

#include <sys/timeb.h>
#include <unistd.h>
#include <stdio.h>
struct timeb tp;
float old_time = 0;
float new_time = 0;
                                                                                                     
                                                                                                     
#define PERFOMANCES     ftime(&tp); \
                        new_time = tp.time + tp.millitm/1000; \
                        fprintf (stdout, "new: %f\n", new_time); \
                        fprintf (stdout, "Performances: delta=%f \n", \
                                 new_time-old_time ); \
                        old_time = new_time;
                                                                                                     
int main (void) {
        while (1) {
                usleep (500000);
                PERFOMANCES
        }
}

Compiling and running it gives you:

bott@dirac:~ > ./test
new: 1058422400.000000
Performances: delta=1058422400.000000
new: 1058422400.000000
Performances: delta=0.000000
new: 1058422400.000000
Performances: delta=0.000000
new: 1058422400.000000
Performances: delta=0.000000
new: 1058422400.000000
Performances: delta=0.000000
new: 1058422400.000000
Performances: delta=0.000000
new: 1058422400.000000
Performances: delta=0.000000
 
It seems that time gets updated only the first time.

If you need to contact me my email is ottavio@campana.vi.it

-- System Information
Debian Release: 3.0
Kernel Version: Linux dirac 2.4.21-dirac #1 SMP lun giu 23 08:07:23 CEST 2003 i686 unknown


---------------------------------------
Received: (at 201664-done) by bugs.debian.org; 8 Oct 2004 03:16:01 +0000
>From gotom@debian.or.jp Thu Oct 07 20:16:01 2004
Return-path: <gotom@debian.or.jp>
Received: from omega.webmasters.gr.jp (webmasters.gr.jp) [218.44.239.78] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1CFlEf-0002wu-00; Thu, 07 Oct 2004 20:16:01 -0700
Received: from omega.webmasters.gr.jp (localhost [127.0.0.1])
	by webmasters.gr.jp (Postfix) with ESMTP
	id 1D2A3DEB5E; Fri,  8 Oct 2004 12:16:01 +0900 (JST)
Date: Fri, 08 Oct 2004 12:16:01 +0900
Message-ID: <818yahx5la.wl@omega.webmasters.gr.jp>
From: GOTO Masanori <gotom@debian.or.jp>
To: 201664-done@bugs.debian.org,
	Francesco Paolo Lovergine <frankie@debian.org>, ottavio@campana.vi.it
Subject: Re: libc: bug in ftime
User-Agent: Wanderlust/2.9.9 (Unchained Melody) SEMI/1.14.3 (Ushinoya)
 FLIM/1.14.3 (=?ISO-8859-4?Q?Unebigory=F2mae?=) APEL/10.3 Emacs/21.2
 (i386-debian-linux-gnu) MULE/5.0 (SAKAKI)
MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya")
Content-Type: text/plain; charset=US-ASCII
Delivered-To: 201664-done@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-3.0 required=4.0 tests=BAYES_00 autolearn=no 
	version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level: 

> I've found a bug in libc using ftime. Give a look at this little code:
> 
(snip)
> #define PERFOMANCES     ftime(&tp); \
>                         new_time = tp.time + tp.millitm/1000; \
>                         fprintf (stdout, "new: %f\n", new_time); \
>                         fprintf (stdout, "Performances: delta=%f \n", \
>                                  new_time-old_time ); \
>                         old_time = new_time;

This code is broken.  "millitm" is milli second resolution, so
tp.millitm/1000 is always 0.

> reassign 201664 libc6
> thanks
> 
> ftime() is obsolete and buggy in many releases of libc. See its current
> manpage also. These days millitm could be broken again.

Wrong, ftime() works fine.

I close this bug because it's bogus.

Regards,
-- gotom



Reply to: