[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-02-08 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 3965ed809a85 by Victor Stinner in branch 'default':
Issue #13845: Fix NEWS entry, the change is specific to Windows
http://hg.python.org/cpython/rev/3965ed809a85

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-02-08 Thread Éric Araujo

Éric Araujo  added the comment:

Please make sure to say “on Windows” in NEWS and commit messages when you’re 
doing platform-specific changes :)

--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-02-07 Thread STINNER Victor

Changes by STINNER Victor :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-02-07 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset bee7943d38c6 by Victor Stinner in branch 'default':
Issue #13845: time.time() now uses GetSystemTimeAsFileTime() instead of ftime()
http://hg.python.org/cpython/rev/bee7943d38c6

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-01-31 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file24306/timespec-2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-01-29 Thread STINNER Victor

STINNER Victor  added the comment:

Two articles (Microsoft and IBM) about high resolution time on Windows:
http://msdn.microsoft.com/en-us/magazine/cc163996.aspx
http://www.ibm.com/developerworks/library/i-seconds/

I installed the Windows port of the NTP daemon:
http://www.meinberg.de/english/sw/ntp.htm

Using the NTP daemon, the resolution is 1 ms instead of 15 ms (on Windows 
Seven). It looks like it is possible to have a resolution of 0.5 ms, but I 
failed to get this resolution.

Attached patch is much more simple than the previous one: it only changes 
_PyTime_gettimeofday().

--
Added file: http://bugs.python.org/file24364/GetSystemTimeAsFileTime.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-01-26 Thread STINNER Victor

STINNER Victor  added the comment:

Using the patch of #13882, I realize that time.time() has a resolution of 1 
millisecond (10^-3) and not of a microsecond (10^-6) on Windows! Windows 
doesn't provide gettimeofday(). Using GetSystemTimeAsFileTime() would provide a 
much better resolution!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-01-24 Thread STINNER Victor

STINNER Victor  added the comment:

> NtSetTimerResolution is a system-wide change, and may have impact on other 
> running applications.  It may be an option to set it during the execution of 
> profile.run() for example, but I would not enable it just to call 
> time.clock().

I was not proposing to call, but it was trying to say that under
certain circumstances, you may have a better resolution than 15 ms.
Python should not limit the resolution if the OS provides a better
resolution.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-01-24 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

NtSetTimerResolution is a system-wide change, and may have impact on other 
running applications.  It may be an option to set it during the execution of 
profile.run() for example, but I would not enable it just to call time.clock().

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-01-24 Thread STINNER Victor

STINNER Victor  added the comment:

> GetSystemTimeAsFileTime() represent durations as multiple of 100ns, 
> unfortunately its value is only updated every 15ms or so.  Precision is not 
> accuracy...

It is possible to improve the accuracy of this clock using the
undocumented NtSetTimerResolution() function:
http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/Time/NtSetTimerResolution.html

There are applications using this undocumented function. For example:
http://www.lucashale.com/timer-resolution/

See also the timeBeginPeriod() function:
http://msdn.microsoft.com/en-us/library/ms713413%28VS.85%29.aspx

The user may have a special hardware (and its driver) or a special
softwared (ntpd?) with a better accuracy.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-01-24 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

GetSystemTimeAsFileTime() represent durations as multiple of 100ns, 
unfortunately its value is only updated every 15ms or so.  Precision is not 
accuracy...

--
nosy: +amaury.forgeotdarc

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-01-23 Thread Ross Lagerwall

Changes by Ross Lagerwall :


--
nosy: +rosslagerwall

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-01-23 Thread STINNER Victor

STINNER Victor  added the comment:

See also #11457 for discussion on nanosecond resolution and a potential new 
type to avoid loose of resolution of the Python float type (IEEE binary64).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-01-23 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file24305/timespec.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-01-23 Thread STINNER Victor

STINNER Victor  added the comment:

Oops, my first patch contains an unrelated change for Windows.

New patch fixes this bug, and change time_clock() to reuse time_time() if 
time_clock() fails to get the CPU frequency (unlikely) because it has a better 
resolution than clock().

--
Added file: http://bugs.python.org/file24306/timespec-2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13845] Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows

2012-01-23 Thread STINNER Victor

New submission from STINNER Victor :

Python implements time.time() using gettimeofday() which has only a resolution 
of 1 microsecond because it uses the timeval structure which is only able to 
store microseconds.

Attached patch changes _PyTime_gettimeofday() to make it uses the timespec 
structure (which has a resolution has 1 nanosecond) and use 
GetSystemTimeAsFileTime() on Windows. So time.time() has a theorical resolution 
10 times better than currently.

--
files: timespec.patch
keywords: patch
messages: 151865
nosy: belopolsky, haypo
priority: normal
severity: normal
status: open
title: Use GetSystemTimeAsFileTime() to get a resolution of 100 ns on Windows
versions: Python 3.3
Added file: http://bugs.python.org/file24305/timespec.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com