🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #10620

Re: Varias duda.

#10620
From: Carlos Mayo
Date: Sun, 17 Feb 2002 21:28
45 lines
2073 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Javier Beltr�n S�nchez escribio:

> Buenas.
> � existe alguna libreria que me permita saber cuando tiempo ha pasado 
> desde que ha transcurrido una parte de un programa ?

  En C++ tengo una clase cronometro, la activo al comienzo de la parte que 
quiero medir y la paro al final. Espero que te sirva de algo:

#ifndef CRONOMETRO_H_
#define CRONOMETRO_H_

#include <ctime>
using std::clock_t;
using std::clock;

class Cronometro {
  clock_t t0,      // instante de tiempo inicial
          t1;      // instante de tiempo final
public:
  void activar() { t0 = clock(); }
  void parar() { t1 = clock(); }
  double tiempo() { return (t1 - t0) / static_cast<double>(CLOCKS_PER_SEC); 
}
};

#endif

- -- 
 Un saludo
  
 Carlos Mayo <cmayo arroba ono punto com>         
 Linux User #209660                     
 Clave p�blica en http://perso.wanadoo.es/cmayo/key.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8cCBtjpPkj1QGn9cRAvYOAJ9c3ZWNEg+c+djhNa701c/pdZYrdQCcDKKG
Cpjp1T4afEbJkUOG28qv0NQ=
=uul5
-----END PGP SIGNATURE-----
Technical Details
Message-ID: <a4p79q$21emn$1@ID-121482.news.dfncis.de>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!ps1-3a-u-0410.mc.onolab.COM!not-for-mail
References: <ab4993a4.0202161432.4f0331f0@posting.google.com>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,94564da90575c33a
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-02-17 13:28:30 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!ps1-3a-u-0410.mc.onolab.COM!not-for-mail
From: Carlos Mayo <cmayo@wanadoo.es>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Varias duda.
Date: Sun, 17 Feb 2002 22:28:22 +0100
Lines: 46
Message-ID: <a4p79q$21emn$1@ID-121482.news.dfncis.de>
References: <ab4993a4.0202161432.4f0331f0@posting.google.com>
NNTP-Posting-Host: ps1-3a-u-0410.mc.onolab.com (62.42.103.155)
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8Bit
X-Trace: fu-berlin.de 1013981306 2144983 62.42.103.155 (16 [121482])
User-Agent: KNode/0.6.1