This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: _winreg.QueryInfoKey Last Modified Time Value Incorrect or Explanation Incorrect
Type: behavior Stage: resolved
Components: Documentation, Windows Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zach.ware Nosy List: python-dev, slw07g, zach.ware
Priority: normal Keywords:

Created on 2014-08-10 06:01 by slw07g, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg225125 - (view) Author: sw (slw07g) Date: 2014-08-10 06:01
The explanation of the 3rd index of the tuple returned from _winreg.QueryInfoKey(key) explains that it is a long representing 100s of nanoseconds since 1/1/1600.

However, when I use this value and convert to the actual date using 
startDate = datetime(1600,1,1)
lastModified = QueryInfoKey(key)[2]
print "%s" % startDate + timedelta(seconds=lastModified*(10**-9)*100) 

The date is about right except for the year value, it's off by one.

I suspect the documentation should say the value in the tuple is the time since 1/1/1601 instead of 1/1/1600. This would corroborate Microsoft's documentation that makes references to 1/1/1601 (i.e. http://technet.microsoft.com/en-ca/aa393040(v=vs.90).aspx)
msg225203 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-08-11 20:02
New changeset 97ed0b51bbc0 by Zachary Ware in branch '2.7':
Issue #22178: Fix the date of the Windows epoch (Jan 1, 1601).
http://hg.python.org/cpython/rev/97ed0b51bbc0

New changeset 847a2bdd5bec by Zachary Ware in branch '3.4':
Issue #22178: Fix the date of the Windows epoch (Jan 1, 1601).
http://hg.python.org/cpython/rev/847a2bdd5bec

New changeset 7fafbb7e1a8f by Zachary Ware in branch 'default':
Closes #22178: Merge with 3.4
http://hg.python.org/cpython/rev/7fafbb7e1a8f
msg225204 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-08-11 20:03
Fixed, thanks for the report!
History
Date User Action Args
2022-04-11 14:58:06adminsetgithub: 66374
2014-08-11 20:03:23zach.waresetversions: + Python 3.4, Python 3.5
nosy: + zach.ware

messages: + msg225204

assignee: zach.ware
components: + Documentation, Windows
2014-08-11 20:02:07python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg225203

resolution: fixed
stage: resolved
2014-08-10 06:01:22slw07gcreate