Module Name: src Committed By: jruoho Date: Mon Mar 1 17:21:02 UTC 2010
Modified Files: src/share/man/man9: Makefile mstohz.9 Log Message: In addition to mstohz(9), document also hztoms. To generate a diff of this commit: cvs rdiff -u -r1.316 -r1.317 src/share/man/man9/Makefile cvs rdiff -u -r1.6 -r1.7 src/share/man/man9/mstohz.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/man/man9/Makefile diff -u src/share/man/man9/Makefile:1.316 src/share/man/man9/Makefile:1.317 --- src/share/man/man9/Makefile:1.316 Fri Feb 12 01:00:22 2010 +++ src/share/man/man9/Makefile Mon Mar 1 17:21:02 2010 @@ -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 @@ 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 Index: src/share/man/man9/mstohz.9 diff -u src/share/man/man9/mstohz.9:1.6 src/share/man/man9/mstohz.9:1.7 --- src/share/man/man9/mstohz.9:1.6 Mon Oct 19 18:41:09 2009 +++ src/share/man/man9/mstohz.9 Mon Mar 1 17:21:02 2010 @@ -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 @@ .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 +nor +.Fn hztoms +make use of expensive 64-bit integer arithmetic. +The result from .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 +will be rounded down to one second if the parameter is larger than 131072 milliseconds.