summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2014-12-02 21:18:07 +0600
committerSergey M․ <dstftw@gmail.com>2014-12-02 21:18:07 +0600
commit706d7d4ee737f0e382df0bae3c8146dd5839995d (patch)
tree72858a548176eb1413d8358236da6cdb55d481c9
parent752c8c9b7635137c519ac9b0872c7155322e51f8 (diff)
downloadyoutube-dl-706d7d4ee737f0e382df0bae3c8146dd5839995d.tar.gz
youtube-dl-706d7d4ee737f0e382df0bae3c8146dd5839995d.tar.xz
youtube-dl-706d7d4ee737f0e382df0bae3c8146dd5839995d.zip
[YoutubeDL] Avoid negative timestamps on Windows
-rwxr-xr-xyoutube_dl/YoutubeDL.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 21c7c298a..f89ac4e1d 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -787,6 +787,10 @@ class YoutubeDL(object):
             info_dict['display_id'] = info_dict['id']
 
         if info_dict.get('upload_date') is None and info_dict.get('timestamp') is not None:
+            # Working around negative timestamps in Windows
+            # (see http://bugs.python.org/issue1646728)
+            if info_dict['timestamp'] < 0 and os.name == 'nt':
+                info_dict['timestamp'] = 0
             upload_date = datetime.datetime.utcfromtimestamp(
                 info_dict['timestamp'])
             info_dict['upload_date'] = upload_date.strftime('%Y%m%d')