Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Jan 2000 15:15:22 -0500 (EST)
From:      Zhihui Zhang <zzhang@cs.binghamton.edu>
To:        freebsd-hackers@freebsd.org
Subject:   negative value from timersub() in time.h
Message-ID:  <Pine.GSO.3.96.1000107150605.1756A-100000@sol.cs.binghamton.edu>

next in thread | raw e-mail | index | archive | help

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.3.96.1000107150605.1756A-100000>