From owner-freebsd-hackers Fri Jan 7 13:29:22 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from bingnet2.cc.binghamton.edu (bingnet2.cc.binghamton.edu [128.226.1.18]) by hub.freebsd.org (Postfix) with ESMTP id B26B91586D for ; Fri, 7 Jan 2000 13:29:19 -0800 (PST) (envelope-from zzhang@cs.binghamton.edu) Received: from sol.cs.binghamton.edu (cs1-gw.cs.binghamton.edu [128.226.171.72]) by bingnet2.cc.binghamton.edu (8.9.3/8.9.3) with SMTP id QAA26840 for ; Fri, 7 Jan 2000 16:29:16 -0500 (EST) Date: Fri, 7 Jan 2000 15:15:22 -0500 (EST) From: Zhihui Zhang To: freebsd-hackers@freebsd.org Subject: negative value from timersub() in time.h Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I use the following statements to time the system time used by a routine: struct rusage ru_start, ru_end; struct timeval stime; getrusage(RUSAGE_SELF, &ru_start); call the routine getrusage(RUSAGE_SELF, &ru_end); timersub(&ru_end.ru_stime, &ru_start.ru_stime, &stime); Sometimes I find that the value of stime.tv_sec is negative (-1). Can anyone explain the reason for me? Any help is appreciated. -Zhihui To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message