Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Mar 1999 17:48:28 +0100 (CET)
From:      tobez@plab.ku.dk
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/10402: times(3) non-decreaseness broken in 4.0
Message-ID:  <199903051648.RAA23394@lion.plab.ku.dk>

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

>Number:         10402
>Category:       kern
>Synopsis:       times(3) non-decreaseness broken in 4.0
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar  5 08:50:01 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Anton Berezin
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
The Protein Laboratory, University of Copenhagen
>Environment:

FreeBSD lion.plab.ku.dk 4.0-CURRENT FreeBSD 4.0-CURRENT #12: Fri Mar  5 13:02:17 CET 1999     root@lion.plab.ku.dk:/usr/src/sys/compile/LION  i386

Different Perls:
perl5.005_02 - standard perl
perl5.005_03-MAINT_TRIAL_6
perl5.005_56

>Description:

(I think the correct category is kern;  I might be wrong)

When testing recent versions of Perl on also-recent 4.0-current, a
strange test failure consistently occurs.  I dug this a little bit,
and it turned out that sometimes the second (or n-th) call to times(3)
can return a value of tms_stime less than that of the first call.

Perl's times() directly translates into a call to times(3) plus
divisions to get values in seconds.

Running a test script below (in How-To-Repeat section) sufficient
number of times, I've got (among the other values)

0 0.0078125
0 0 (i = 100000, beg = 920651342, time = 920651344)
----------------

and

0 0.0078125
0.0078125 0 (i = 100000, beg = 920651344, time = 920651347)
----------------

which clearly shows that system time can actually decrease.

>How-To-Repeat:

Create a perl script
----------------------8<---------------------8<---------------
#! /usr/bin/perl

($beguser,$begsys) = times;
$beg = time;

for ($i = 0; $i < 100000; $i++) {
    ($nowuser, $nowsys) = times;
    $i = 200000 if $nowuser > $beguser && ( $nowsys > $begsys || 
                                            (!$nowsys && !$begsys));
    last if time - $beg > 20;
}
my $ttt = time;
if ($i < 200000) {
   print "$beguser $begsys\n";
   print "$nowuser $nowsys (i = $i, beg = $beg, time = $ttt)\n";
   print "----------------\n";
}
----------------------8<---------------------8<---------------

and run it several times, better in a shell loop.

>Fix:
	

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903051648.RAA23394>