.\" -*- coding: UTF-8 -*- .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) .\" .\" %%%LICENSE_START(VERBATIM) .\" 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_END .\" .\" 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 UNIX systems with respect to .\" waited-for children. .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH CLOCK 3 "15 setembro 2017" GNU "Manual do Programador do Linux" .SH NOME clock \- retorna o tempo de CPU .SH SINOPSE .nf \fB#include \fP .PP \fBclock_t clock(void);\fP .fi .SH DESCRIÇÃO A função \fBclock\fP() retorna uma aproximação do tempo de processamento usado pelo programa. .SH "VALOR DE RETORNO" O valor retornado é o tempo de CPU usado até o momento como um \fBclock_t\fP. Para obter o número de segundos, divida por \fBCLOCKS_PER_SEC\fP. Se o tempo de processador não estiver disponível ou o valor não puder ser representado, a função retorna \fI(clock_t)\ \-1\fP. .SH ATRIBUTOS Para uma explicação dos termos usados nesta seção, consulte \fBattributes\fP(7). .TS allbox; lb lb lb l l l. Interface Atributo Valor T{ \fBclock\fP() T} Thread safety MT\-Safe .TE .sp 1 .SH "DE ACORDO COM" POSIX.1\-2001, POSIX.1\-2008, C89, C99. XSI exige que \fBCLOCKS_PER_SEC\fP seja 1000000 independente da resolução verdadeira. .SH NOTAS O padrão C permite valores arbitrários no início do programa. Use a diferença entre uma chamada a \fBclock\fP() no início e outra no final do programa para obter portabilidade máxima. .PP O tempo pode sofrer 'overflow'. Num sistema de 32 bits com \fBCLOCKS_PER_SEC\fP igual a 1000000, esta função retornará um valor idêntico aproximadamente a cada 72 minutos. .PP .\" I have seen this behavior on Irix 6.3, and the OSF/1, HP/UX, and .\" Solaris manual pages say that clock() also does this on those systems. .\" POSIX.1-2001 doesn't explicitly allow this, nor is there an .\" explicit prohibition. -- MTK Em várias outras implementações, o valor retornado por \fBclock\fP() também inclui os horários de todos os filhos cujo status foi coletado por \fBwait\fP(2) (ou outra chamada do tipo espera). O Linux não inclui os tempos de filhos esperados no valor retornado por \fBclock\fP(). A função \fBtimes\fP(2), que retorna explicitamente informações (separadas) sobre o chamador e seus filhos, pode ser preferível. .PP No glibc 2.17 e versões anteriores, \fBclock\fP() estava implementado usando \fBtimes\fP(2). Para maior precisão, desde o glibc 2.18, ele é implementado sobre \fBclock_gettime\fP(2) (usando o relógio \fBCLOCK_PROCESS_CPUTIME_ID\fP). .SH "VEJA TAMBÉM" \fBclock_gettime\fP(2), \fBgetrusage\fP(2), \fBtimes\fP(2) .SH COLOFÃO Esta página faz parte da versão 5.10 do projeto Linux \fIman\-pages\fP. Uma descrição do projeto, informações sobre relatórios de bugs e a versão mais recente desta página podem ser encontradas em \%https://www.kernel.org/doc/man\-pages/. .PP .SH TRADUÇÃO A tradução para português brasileiro desta página man foi criada por Paulo César Mendes , André Luiz Fassone e Rafael Fontenelle . . .PP Esta tradução é uma documentação livre; leia a .UR https://www.gnu.org/licenses/gpl-3.0.html Licença Pública Geral GNU Versão 3 .UE ou posterior para as condições de direitos autorais. Nenhuma responsabilidade é aceita. .PP Se você encontrar algum erro na tradução desta página de manual, envie um e-mail para .MT debian-l10n-portuguese@lists.debian.org a lista de discussão de tradutores .ME .