.\" (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" License. .\" Modified Sat Jul 24 21:27:01 1993 by Rik Faith (faith@cs.unc.edu) .\" Modified 14 Jun 2002, Michael Kerrisk .\" Added notes on differences from other Unices with respect to .\" waited-for children. .\" .\" Traducido al castellano (con permiso) por: .\" Sebastian Desimone (chipy@argenet.com.ar) (desimone@fasta.edu.ar) .\" Translation revised May 5 1998 by Rafael Rios (rafarios@arrakis.es) .\" Translation revised Tue Apr 18 2000 by Juan Piernas .\" Traducción revisada por Miguel Pérez Ibars el 15-enero-2005 .\" .TH CLOCK 3 "14 junio 2002" "GNU" "Manual del Programador de Linux" .SH NOMBRE clock \- Determina el tiempo de uso del procesador .SH SINOPSIS .nf .B #include .sp .B clock_t clock(void); .fi .SH DESCRIPCIÓN La función .B clock() devuelve una aproximación del tiempo del procesador usado por el programa. .SH "VALOR DEVUELTO" El valor devuelto es el tiempo de CPU usado medido en .BR clock_t ; para obtener el equivalente en segundos, divida el valor devuelto por .BR CLOCKS_PER_SEC . Si el tiempo de procesador usado no está disponible o su valor no puede ser representado, la función devuvelve el valor (clock_t)-1. .SH "CONFORME A" ANSI C. POSIX necesita que CLOCKS_PER_SEC sea igual a 1000000 independientemente de la resolución real. .SH OBSERVACIONES El C estándar permite que la función devuelva valores arbitrarios al comienzo del programa. Reste el valor devuelto por una llamada .B clock() al comienzo del programa para obtener la máxima portabilidad. .PP Dese cuenta que el tiempo puede volver a ser 0. En un sistema de 32 bits donde CLOCKS_PER_SEC es igual a 1000000, esta función devolverá el mismo valor cada 72 minutos, aproximadamente. .PP En muchas otras implementaciones, el valor devuelto por .BR clock () incluye también los tiempos de cualquier hijo cuyo estado haya sido recogido via .BR wait () (u otra llamada tipo wait). Linux no incluye los tiempos de los hijos a los que se ha esperado en el valor devuelto por .BR clock (). .\" He visto este comportamiento en Irix 6.3, y el OSF/1, HP/UX, y .\" las páginas de manual de Solaris indican que clock() también se comporta así .\" en esos sistemas. .\" POSIX 1003.1-2001 no permite ésto explícitamente, ni tampoco hay una .\" prohibición explícita. -- MTK La función