Skip to content

Commit 849e275

Browse files
committed
Clarify ZipInfo.date_time attribute documentation to specify source of timestamp and limitations
1 parent 5334732 commit 849e275

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Doc/library/zipfile.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,18 @@ Instances have the following methods and attributes:
818818
.. attribute:: ZipInfo.date_time
819819

820820
The time and date of the last modification to the archive member. This is a
821-
tuple of six values:
821+
tuple of six values representing the "last mod file time" and "last mod file date"
822+
fields from the ZIP file's central directory.
823+
824+
.. note::
825+
826+
The ZIP format supports multiple timestamp fields in different locations
827+
(central directory, extra fields for NTFS/UNIX systems, etc.). This attribute
828+
specifically returns the timestamp from the central directory. Future Python
829+
versions may use alternative timestamp sources if they provide better accuracy
830+
or precision.
831+
832+
The tuple contains:
822833

823834
+-------+--------------------------+
824835
| Index | Value |
@@ -838,7 +849,10 @@ Instances have the following methods and attributes:
838849

839850
.. note::
840851

841-
The ZIP file format does not support timestamps before 1980.
852+
The central directory timestamp format in ZIP files does not support
853+
timestamps before 1980. While some extra field formats (such as UNIX
854+
timestamps) can represent earlier dates, this attribute only returns
855+
the central directory timestamp.
842856

843857

844858
.. attribute:: ZipInfo.compress_type

0 commit comments

Comments
 (0)