From a866b2a004e7d658c74686c6f1115d38522aff00 Mon Sep 17 00:00:00 2001 From: jruoho Date: Mon, 1 Mar 2010 17:21:02 +0000 Subject: [PATCH] In addition to mstohz(9), document also hztoms. --- share/man/man9/Makefile | 3 ++- share/man/man9/mstohz.9 | 26 ++++++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 94a553641168..9e76d89d748c 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.316 2010/02/12 01:00:22 dyoung Exp $ +# $NetBSD: Makefile,v 1.317 2010/03/01 17:21:02 jruoho Exp $ # Makefile for section 9 (kernel function and variable) manual pages. @@ -414,6 +414,7 @@ MLINKS+=microuptime.9 binuptime.9 \ microuptime.9 getmicrouptime.9 \ microuptime.9 nanouptime.9 \ microuptime.9 getnanouptime.9 +MLINKS+=mstohz.9 hztoms.9 MLINKS+=mutex.9 mutex_init.9 mutex.9 mutex_destroy.9 mutex.9 mutex_enter.9 \ mutex.9 mutex_exit.9 mutex.9 mutex_tryenter.9 mutex.9 mutex_owned.9 \ mutex.9 mutex_spin_enter.9 mutex.9 mutex_spin_exit.9 diff --git a/share/man/man9/mstohz.9 b/share/man/man9/mstohz.9 index a492eceecb76..1e04b621efc1 100644 --- a/share/man/man9/mstohz.9 +++ b/share/man/man9/mstohz.9 @@ -1,4 +1,4 @@ -.\" $NetBSD: mstohz.9,v 1.6 2009/10/19 18:41:09 bouyer Exp $ +.\" $NetBSD: mstohz.9,v 1.7 2010/03/01 17:21:02 jruoho Exp $ .\" .\" Copyright (c) 2002 Manuel Bouyer. .\" @@ -24,24 +24,29 @@ .\" SUCH DAMAGE. .\" .\" -.Dd April 4, 2002 +.Dd February 10, 2010 .Dt MSTOHZ 9 .Os .Sh NAME .Nm mstohz -.Nd convert milliseconds to system clock ticks +.Nd convert between milliseconds and system clock ticks .Sh SYNOPSIS .In sys/param.h .Ft int .Fn mstohz "int ms" +.Ft int +.Fn hztoms "int hz" .Sh DESCRIPTION .Nm can be used to convert time in milliseconds to system clock ticks, as used by the .Xr callout 9 facility, in an integer-overflow safe way. +Conversely, +.Fn hztoms +converts system clock ticks to milliseconds. .Pp -This function is implemented as a define in the +These macros are defined in the .Em \*[Lt]sys/param.h\*[Gt] header. Individual ports can have a processor-specific, more efficient @@ -49,12 +54,17 @@ version implemented in their .Em \*[Lt]machine/param.h\*[Gt] header as a define. .Sh RETURN VALUES -The return value is the number of clock ticks for the specified value. +The return value is either the number of clock ticks or milliseconds +for the specified value. .Sh SEE ALSO .Xr callout 9 .Sh BUGS -The machine-independent +Neither .Fn mstohz -function does not make use of expensive 64-bit integer arithmetic, so -the result will be rounded down to one second if the parameter is larger +nor +.Fn hztoms +make use of expensive 64-bit integer arithmetic. +The result from +.Fn mstohz +will be rounded down to one second if the parameter is larger than 131072 milliseconds.