Show More
@@ -19,6 +19,7 b' import error, osutil, encoding, parsers' | |||||
19 | import errno, shutil, sys, tempfile, traceback |
|
19 | import errno, shutil, sys, tempfile, traceback | |
20 | import re as remod |
|
20 | import re as remod | |
21 | import os, time, datetime, calendar, textwrap, signal, collections |
|
21 | import os, time, datetime, calendar, textwrap, signal, collections | |
|
22 | import stat | |||
22 | import imp, socket, urllib |
|
23 | import imp, socket, urllib | |
23 | import gc |
|
24 | import gc | |
24 | import bz2 |
|
25 | import bz2 | |
@@ -953,7 +954,18 b' def fstat(fp):' | |||||
953 | return os.stat(fp.name) |
|
954 | return os.stat(fp.name) | |
954 |
|
955 | |||
955 | def statmtimesec(st): |
|
956 | def statmtimesec(st): | |
956 | return int(st.st_mtime) |
|
957 | """Get mtime as integer of seconds | |
|
958 | ||||
|
959 | 'int(st.st_mtime)' cannot be used because st.st_mtime is computed as | |||
|
960 | 'sec + 1e-9 * nsec' and double-precision floating-point type is too narrow | |||
|
961 | to represent nanoseconds. If 'nsec' is close to 1 sec, 'int(st.st_mtime)' | |||
|
962 | can be 'sec + 1'. (issue4836) | |||
|
963 | """ | |||
|
964 | try: | |||
|
965 | return st[stat.ST_MTIME] | |||
|
966 | except TypeError: | |||
|
967 | # osutil.stat doesn't allow index access and its st_mtime is int | |||
|
968 | return st.st_mtime | |||
957 |
|
969 | |||
958 | # File system features |
|
970 | # File system features | |
959 |
|
971 |
General Comments 0
You need to be logged in to leave comments.
Login now