--
------------------------------------
Grupo Python-Brasil
http://www.python.org.br/wiki/AntesDePerguntar
<*> Para visitar o site do grupo na web, acesse:
http://groups.google.com/group/python-brasil
<*> Para sair deste grupo, envie um e-mail para:
python-brasi...@googlegroups.com
On Unix, return the current processor time as a floating point number expressed in seconds. The precision, and in fact the very definition of the meaning of “processor time”, depends on that of the C function of the same name, but in any case, this is the function to use for benchmarking Python or timing algorithms.
On Windows, this function returns wall-clock seconds elapsed since the first call to this function, as a floating point number, based on the Win32 function QueryPerformanceCounter(). The resolution is typically better than one microsecond.
--
------------------------------------
Grupo Python-Brasil
http://www.python.org.br/wiki/AntesDePerguntar
<*> Para visitar o site do grupo na web, acesse:
http://groups.google.com/group/python-brasil
<*> Para sair deste grupo, envie um e-mail para:
python-brasi...@googlegroups.com
Oi Paulo,
> Pelo que estou vendo na documentação do Python o módulo/biblioteca
> time<http://docs.python.org/library/time.html> não
> tem recursos para retornar milisegundos. Qual o recurso que devo usar para
> o caso de um código como o que segue eu conseguir a medida com milisegundos?
>
> *gist*: https://gist.github.com/1392037
Pelo que eu vi você quer usar o strftime pra formatar, né?! Buscando
rapidamente no google vi que adicionaram no python 2.6 a feature de
`microseconds` no módulo datetime.
Use o datetime ao invés do time. O seu caso é bem simples, e o
datetime pode substituir facilmente suas chamadas de time. Por
exemplo:
>>> from datetime import datetime
>>> datetime.now().strftime('%H:%M:%S:%f')
'00:11:41:472649'
[]s
Referência: http://stackoverflow.com/questions/698223/how-can-i-parse-a-time-string-containing-milliseconds-in-it-with-python
Leia de novo:"The precision is tipically better than one microsecond."
--
------------------------------------
Grupo Python-Brasil
http://www.python.org.br/wiki/AntesDePerguntar
<*> Para visitar o site do grupo na web, acesse:
http://groups.google.com/group/python-brasil
<*> Para sair deste grupo, envie um e-mail para:
python-brasi...@googlegroups.com