NetBSD Problem Report #16116

Received: (qmail 19409 invoked from network); 29 Mar 2002 16:48:36 -0000
Message-Id: <Pine.SOL.4.33.0203291631510.17525-100000@draco.cus.cam.ac.uk>
Date: Fri, 29 Mar 2002 16:48:35 +0000 (GMT)
From: Ben Harris <bjh21@netbsd.org>
Sender: Ben Harris <bjh21@cus.cam.ac.uk>
To: <gnats-bugs@gnats.netbsd.org>
Subject: clock_getres(CLOCK_REALTIME) is pessimistic

>Number:         16116
>Category:       kern
>Synopsis:       clock_getres(CLOCK_REALTIME) is pessimistic
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 29 16:49:00 +0000 2002
>Closed-Date:    
>Last-Modified:  
>Originator:     Ben Harris
>Release:        2002-03-28
>Organization:
>Environment:
>Description:

sys_clock_getres() (in sys/kern/kern_time.c) always returns a value based
on hz when asked about CLOCK_REALTIME.  Since sys_clock_gettime() calls
microtime() to get CLOCK_REALTIME, it may actually have a resolution well
above hz.

>How-To-Repeat:

Look at the definition of sys_clock_getres():

        case CLOCK_REALTIME:
        case CLOCK_MONOTONIC:
                ts.tv_sec = 0;
                ts.tv_nsec = 1000000000 / hz;

whereas in sys_clock_gettime():

        case CLOCK_REALTIME:
                microtime(&atv);
                TIMEVAL_TO_TIMESPEC(&atv,&ats);
                break;

>Fix:

Add a machine-dependent microtime_getres(), maybe?



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

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.