We're going around in circles. I'm not asking what sleep does, I want
on principle a timer that does the same thing as sleep(), regardless
of how sleep() works. So if on some OS sleep() uses the same algorithm
as CLOCK_MONOTONIC_RAW, I want my timer to use that too. But if on
some other OS
2012/4/9 Guido van Rossum gu...@python.org:
You may need two clocks
for this:
* time.perf_counter(): high-resolution timer for benchmarking, count
time elasped during a sleep
* time.process_time(): High-resolution (?) per-process timer from the
CPU. (other possible names:
| * time.process_time(): High-resolution (?) per-process timer from the
| CPU. (other possible names: time.process_cpu_time() or
| time.cpu_time())
POSIX offers CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID that
seem to suit this need, depending on your threading situation (and what
On 09Apr2012 13:26, Victor Stinner victor.stin...@gmail.com wrote:
| | On Windows, GetProcessTimes() has not a high-resolution: it has a
| | accuracy of 1 ms in the best case.
|
| This page:
|
http://msdn.microsoft.com/en-us/library/windows/desktop/ms683223%28v=vs.85%29.aspx
| says
sleep() is implemented in the kernel. The kernel is notified when a
clock is set, and so can choose how to handle time adjustement. Most
sleeping functions use the system clock but don't care of clock
adjustement.
We're going around in circles. I'm not asking what sleep does, I want
on
| I made the same suggestion earlier but I don't know that anyone did
| anything with it. :-( It would be nice to know what clock sleep() uses
| on each of the major platforms.
I saw it but didn't know what I could do with it, or even if it can be
found out in any very general sense.
On Sun, Apr 8, 2012 at 3:42 AM, Antoine Pitrou solip...@pitrou.net wrote:
| I made the same suggestion earlier but I don't know that anyone did
| anything with it. :-( It would be nice to know what clock sleep() uses
| on each of the major platforms.
I saw it but didn't know what I could do
On Sun, 8 Apr 2012 07:29:30 -0700
Guido van Rossum gu...@python.org wrote:
What to name it can't be decided this way, although I might put
forward time.sleeptimer().
interval_timer() ?
I would suggest timer() simply, but it's too close to time().
I personally have a need for one potentially
IOW What's good enough for sleep() is good enough for
user-implemented timeouts and scheduling. as a way to reach at least
one decision for a platform with agreed-upon cross-platform
characteristics that are useful.
sleep() is implemented in the kernel. The kernel is notified when a
clock is
On 09Apr2012 02:00, Victor Stinner victor.stin...@gmail.com wrote:
| I personally have a need for one potentially different clock -- to
| measure short intervals for benchmarks and profiling. This might be
| called time.performancetimer()?
|
| I deferred this topic because it is unclear to me
On Sun, Apr 8, 2012 at 5:00 PM, Victor Stinner victor.stin...@gmail.com wrote:
IOW What's good enough for sleep() is good enough for
user-implemented timeouts and scheduling. as a way to reach at least
one decision for a platform with agreed-upon cross-platform
characteristics that are useful.
On Fri, Apr 6, 2012 at 11:32 PM, Victor Stinner
victor.stin...@gmail.com wrote:
On Linux, I now prefer
to use CLOCK_MONOTONIC (monotonic) than CLOCK_MONOTONIC_RAW
(monotonic and steady as defined by C++) *because* its frequency is
adjusted.
I don't think that's a reason that should be
On Sat, Apr 7, 2012 at 8:47 AM, Victor Stinner victor.stin...@gmail.com wrote:
Objects of class steady_clock represent clocks for which values of
time_point advance at a steady rate relative to real time. That is,
the clock may not be adjusted.
On 7 April 2012 09:12, Stephen J. Turnbull step...@xemacs.org wrote:
I don't think that's a reason that should be considered. There just
doesn't seem to be a single best clock, nor do clocks of similar
character seem to be easy to find across platforms. So the reasons
I'd like to see are of
On 07Apr2012 01:47, Victor Stinner victor.stin...@gmail.com wrote:
| I don't understand this definition. All clocks have a clock drift.
| This is just one exception: atomic clocks, but such clocks are rare
| and very expensive.
They've got drift too. It is generally very small.
Anecdote: I used
On Apr 7, 2012, at 3:08 AM, Paul Moore wrote:
Use cases:
Display the current time to a human (e.g. display a calendar or draw a
wall clock): use system clock, i.e. time.time() or
datetime.datetime.now().
Event scheduler, timeout: time.monotonic().
Benchmark, profiling: time.clock() on
Thank you for your veto. Still, again for the sake of keeping track of things
and such, there is this: http://en.wikipedia.org/wiki/Wall_clock_time and also
my original suggestion: http://bugs.python.org/issue10278
In the end, the world shall be ruled by the nomenclaturists.
K
Just to clarify my previous post.
It seems clear that benchmarking and timeout logic would benefit from a clock
that cannot be adjusted by NTP.
I'm unclear on whether time.sleep() will be based on the same clock so that
timeouts and sleeps are on the same basis.
For scheduling logic (such as
Victor et al,
Just an update note:
I've started marking up clocks with attributes; not yet complete and I
still need to make a small C extension to present the system clocks to
Python space (which means learning to do that, too).
But you can glance over the start on it here:
On Sat, Apr 7, 2012 at 6:26 PM, Raymond Hettinger
raymond.hettin...@gmail.com wrote:
Just to clarify my previous post.
It seems clear that benchmarking and timeout logic would benefit from a clock
that cannot be adjusted by NTP.
I'm unclear on whether time.sleep() will be based on the same
On 07Apr2012 18:49, Guido van Rossum gu...@python.org wrote:
| On Sat, Apr 7, 2012 at 6:26 PM, Raymond Hettinger
| raymond.hettin...@gmail.com wrote:
| Just to clarify my previous post.
| It seems clear that benchmarking and timeout logic would benefit
| from a clock that cannot be adjusted by
On Apr 5, 2012, at 8:07 PM, Zooko Wilcox-O'Hearn wrote:
On Thu, Apr 5, 2012 at 7:14 PM, Greg Ewing greg.ew...@canterbury.ac.nz
wrote:
This is the strict mathematical meaning of the word monotonic, but the way
it's used in relation to OS clocks, it seems to mean rather more than that.
On Fri, Apr 6, 2012 at 3:39 PM, Glyph Lefkowitz gl...@twistedmatrix.com wrote:
There seems to be a persistent desire in this discussion to specify and
define these flaws out of existence, where this API really should instead be
embracing the flaws and classifying them.
That seems to be
Glyph Lefkowitz wrote:
On Apr 5, 2012, at 8:07 PM, Zooko Wilcox-O'Hearn wrote:
2. Those who think that monotonic clock means a clock that never jumps,
and that runs at a rate approximating the rate of real time. This is a
very useful kind of clock to have! It is what C++ now calls a steady
On 6 April 2012 11:12, Steven D'Aprano st...@pearwood.info wrote:
Glyph Lefkowitz wrote:
On Apr 5, 2012, at 8:07 PM, Zooko Wilcox-O'Hearn wrote:
2. Those who think that monotonic clock means a clock that never jumps,
and that runs at a rate approximating the rate of real time. This is a
2. Those who think that monotonic clock means a clock that never
jumps, and that runs at a rate approximating the rate of real time.
This is a very useful kind of clock to have! It is what C++ now calls
a steady clock. It is what all the major operating systems provide.
Python cannot give
I'd like to veto wall clock because to me that's the clock on my wall, i.e.
local time. Otherwise I like the way this thread is going.
--Guido van Rossum (sent from Android phone)
On Apr 6, 2012 4:57 AM, Paul Moore p.f.mo...@gmail.com wrote:
On 6 April 2012 11:12, Steven D'Aprano
This is the most amusing of discussions.
Teh key sentence here is the clock may not be adjusted. Slewing or
accelerating a clock is nerely adding to the already present error of the pace
of the clock.
Sometimes a clock runs fast, sometimes it runs slow. This is without any
purposeful slewing
This is the original reason for the original defect (issue 10278)
unix' clock() doesn't actually provide a clock in this sense, it provides a
resource usage metric.
K
Frá: python-dev-bounces+kristjan=ccpgames@python.org
On 06Apr2012 15:19, I wrote:
| On 06Apr2012 14:31, Steven D'Aprano st...@pearwood.info wrote:
| | Here is a non-monotonic sequence:
| |
| | 1, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 8
| |
| | This isn't steady either, because it jumps backwards.
| |
| | To be steady, it MUST also be monotonic. If
On 06Apr2012 17:07, Kristj�n Valur J�nsson krist...@ccpgames.com wrote:
| Steven D'Aprano:
| I think that this is incorrect.
| py time.clock(); time.sleep(10); time.clock()
| 0.41
| 0.41
|
| This is the original reason for the original defect (issue 10278)
| unix' clock() doesn't actually
| This is the original reason for the original defect (issue 10278)
| unix' clock() doesn't actually provide a clock in this sense, it provides a
resource usage metric.
Yeah:-( Its help says Return the CPU time or real time since [...].
Two very different things, as demonstrated. I suppose
2. Those who think that monotonic clock means a clock that never
jumps, and that runs at a rate approximating the rate of real time.
This is a very useful kind of clock to have! It is what C++ now calls
a steady clock. It is what all the major operating systems provide.
For the C++ part, I
On Thu, Apr 5, 2012 at 7:14 PM, Greg Ewing greg.ew...@canterbury.ac.nz wrote:
This is the strict mathematical meaning of the word monotonic, but the way
it's used in relation to OS clocks, it seems to mean rather more than that.
Yep. As far as I can tell, nobody has a use for an unsteady,
On 05Apr2012 21:07, Zooko Wilcox-O'Hearn zo...@zooko.com wrote:
| On Thu, Apr 5, 2012 at 7:14 PM, Greg Ewing greg.ew...@canterbury.ac.nz
wrote:
| This is the strict mathematical meaning of the word monotonic,
| but the way it's used in relation to OS clocks, it seems to mean rather
| more than
Cameron Simpson wrote:
| The main reason to use the word monotonic clock to refer to the
| second concept is that POSIX does so, but since Mac OS X, Solaris,
| Windows, and C++ have all avoided following POSIX's mistake, I think
| Python should too.
No. If it is not monotonic, DO NOT CALL IT
On 06Apr2012 14:31, Steven D'Aprano st...@pearwood.info wrote:
| Cameron Simpson wrote:
| | The main reason to use the word monotonic clock to refer to the
| | second concept is that POSIX does so, but since Mac OS X, Solaris,
| | Windows, and C++ have all avoided following POSIX's mistake, I
37 matches
Mail list logo