I am trying to record how long an operation takes, but can't seem to
find a function that will allow me to record the timestamp in
milliseconds, maybe I am looking in the wrong place? 15 25486
mjs7231 wrote: I am trying to record how long an operation takes, but can't seem to find a function that will allow me to record the timestamp in milliseconds, maybe I am looking in the wrong place?
I have no idea where you look - but the time-module has IMHO a descriptive
enough name - so look there and be a happy camper.
--
Regards,
Diez B. Roggisch
"Return the time as a floating point number expressed in seconds since
the epoch, in UTC. Note that even though the time is always returned as
a floating point number, not all systems provide time with a better
precision than 1 second. While this function normally returns
non-decreasing values, it can return a lower value than a previous call
if the system clock has been set back between the two calls. "
This is no good, I am looking for milliseconds, not seconds.. as stated
above.
>>>>> "mjs7231" == mjs7231 <mj*****@gmail.com> writes:
mjs7231> This is no good, I am looking for milliseconds, not
mjs7231> seconds.. as stated above.
Well seconds/1000.0 = millseconds -- or are you worries about floating
point error?
7 >>> from datetime import datetime
8 >>> dt = datetime.now()
9 >>> dt.microsecond
Out[9]: 20222
Converting to milliseconds is left as an exercise for the reader...
See also the timeit module...
JDH
mjs7231 wrote: "Return the time as a floating point number expressed in seconds since the epoch, in UTC. Note that even though the time is always returned as a floating point number, not all systems provide time with a better precision than 1 second. While this function normally returns non-decreasing values, it can return a lower value than a previous call if the system clock has been set back between the two calls. "
This is no good, I am looking for milliseconds, not seconds.. as stated above.
If your system _can_ provide better accuracy than seconds, it is returned as
fraction of a second. That is the whole point the result of time being a
float and not an int.
--
Regards,
Diez B. Roggisch
"This is no good, I am looking for milliseconds, not seconds.. as
stated
above. "
The docs are not very clear. I had the same issue when I was trying to
do the same thing, but the time and datetime modules return
milliseconds on my linux machines.
"mjs7231" <mj*****@gmail.com> wrote: "Return the time as a floating point number expressed in seconds since the epoch, in UTC. Note that even though the time is always returned as a floating point number, not all systems provide time with a better precision than 1 second. While this function normally returns non-decreasing values, it can return a lower value than a previous call if the system clock has been set back between the two calls. "
This is no good, I am looking for milliseconds, not seconds.. as stated above.
are you sure you know what a millisecond is?
can you spot the milliseconds here: import time time.time()
1108575508.234 time.time()
1108575515.062
or here:
time.clock()
1.6349019714375455 time.clock()
2.2402415685960024 time.clock()
2.7715522631434739
</F>
mjs7231 wrote: This is no good, I am looking for milliseconds, not seconds.. as stated above.
That IS what you want.
seconds * 100 = milliseconds
--
Brian Beck
Adventurer of the First Order
Brian Beck wrote: That IS what you want.
seconds * 100 = milliseconds
are you sure you know what a millisecond is?
(duck)
Brian Beck wrote: That IS what you want.
seconds * 100 = milliseconds
May I assume that this IS what you want ?
()___
()//__/)_________________()
||(___)//#/_/#/_/#/_/#()/||
||----|#| |#|_|#|_|#|_|| ||
||____|_|#|_|#|_|#|_|#||/||
|| |#|_|#|_|#|_|#|_||
:)
(credits to jgs, found on http://www.ascii-art.de/ascii/ab/bed.txt)
--
Amand Tihon
Fredrik Lundh wrote: Brian Beck wrote:
That IS what you want.
seconds * 100 = milliseconds
are you sure you know what a millisecond is?
(duck)
Touché.
But it was a typo.
--
Brian Beck
Adventurer of the First Order
On 2005-02-16, Brian Beck <ex****@gmail.com> wrote: seconds * 100 = milliseconds
are you sure you know what a millisecond is?
(duck)
Touché.
But it was a typo.
Oh, you meant 'seconds / 100 = milliseconds'?
(canard)
Curt wrote: Oh, you meant 'seconds / 100 = milliseconds'?
(canard)
I assume you're suggesting that there are two typos in my original post
(the * and the 100)...
Despite a millisecond being a thousandth of a second, given the number
of seconds provided by the time module, he does have to *multiply* by a
thousand to get the number of milliseconds.
2 seconds * 1000 = 2000 milliseconds
So, aside from the 100 in the original post, it may look misleading, but
that is what he would need to do...
--
Brian Beck
Adventurer of the First Order
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 > "Brian" == Brian Beck <ex****@gmail.com> writes:
Brian> Despite a millisecond being a thousandth of a second [...]
A math teacher! A math teacher! My kingdom for a math teacher!
Martin
- --
Homepage: http://www.cs.auc.dk/~factotum/
GPG public key: http://www.cs.auc.dk/~factotum/gpgkey.txt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using Mailcrypt+GnuPG <http://www.gnupg.org>
iEYEARECAAYFAkIUxPkACgkQYu1fMmOQldXH3QCdGcw3grK/R17kfakMBhxU1Io/
4ukAoJl+gysL9q/6j1G8LYPZz7NawEV+
=1CNL
-----END PGP SIGNATURE-----
Martin Christensen wrote: A math teacher! A math teacher! My kingdom for a math teacher!
Martin
Man, this is the hottest topic on c.l.py since that Lazaridis guy...
--
Brian Beck
Adventurer of the First Order
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 > "Brian" == Brian Beck <ex****@gmail.com> writes:
Brian> Man, this is the hottest topic on c.l.py since that Lazaridis
Brian> guy...
.... which was really the point of my joke, even if it did belly flop
somewhat. This whole discussions brought to mind a cartoon where a
group of doctors were performing open heart surgery. One of them says,
"Okay, how many of us believe that the heart has _four_ chambers?,"
and a few of the others raise their hands. I intended it as a 'let's
call in the professors to determine if 2+2=4', but, well... :-)
Martin
- --
Homepage: http://www.cs.auc.dk/~factotum/
GPG public key: http://www.cs.auc.dk/~factotum/gpgkey.txt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using Mailcrypt+GnuPG <http://www.gnupg.org>
iEYEARECAAYFAkIUyzAACgkQYu1fMmOQldWVdACdHLxtUi4TtF Cl0ZW6wf65Hu9M
ioMAoMWAHrkS5lhQw5V0cJXVO1nk76MO
=6MXl
-----END PGP SIGNATURE----- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Patrick Useldinger |
last post by:
Hi all,
after my unsuccessful try to run Apache 2 with mod_python and Python
2.3, I am looking for an alternative approach.
My aim is to write a small web-based application:
Python
- the...
|
by: John Draper |
last post by:
I am having a lot of problems trying to get a Python CGI to run.
I have included 3 parts...
1) A simple stripped down python module.
2) An output of what I get when I do: python index.py...
|
by: Kenneth McDonald |
last post by:
Can anyone recommend something which will do one of the
following:
1) Parse a Python file into an "object-oriented" syntax
tree of some sort (eg. with function definitions represented
by a...
|
by: stephen.mayer |
last post by:
Anyone know which is faster? I'm a PHP programmer but considering
getting into Python ... did searches on Google but didn't turn much up
on this.
Thanks!
Stephen
|
by: Iwan van der Kleyn |
last post by:
Please ignore if you are allergic to ramblings :-)
Despite a puritan streak I've always tried to refrain from language wars
or syntax bickering; call it enforced pragmatism. That's the main...
|
by: Miguel Manso |
last post by:
Hi, list.
I'm into a psicological doubt that I would like to share with you
(you'll know why later on this mail).
I'm a programmer with 5 year of experience into Perl. I'm on that point
where...
|
by: jkohans |
last post by:
Hello,
I am having some trouble getting a Python client written using SOAPpy
0.11.6 to work with a Web Service that is published using AXIS C++
version 1.4. I have a C++ client working, and I...
|
by: Hoop |
last post by:
Hi,
I have been working in getting Boost.Python running on my PC, seems to
work now.
I have what I believe is somewhat of basic question here.
I am starting on an application that will...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |