summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zipstream.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/zipstream.php b/zipstream.php
index 48d3b9e..f23fb8b 100644
--- a/zipstream.php
+++ b/zipstream.php
@@ -204,10 +204,17 @@ class ZipStream {
}
function dostime($when = 0) {
+ # get date array for timestamp
$d = getdate($when);
+
+ # set lower-bound on dates
if ($d['year'] < 1980)
$d = array('year' => 1980, 'mon' => 1, 'mday' => 1, 'hours' => 0, 'minutes' => 0, 'seconds' => 0);
+ # remove extra years from 1980
+ $d['year'] -= 1980;
+
+ # return date string
return ($d['year'] << 25) | ($d['mon'] << 21) | ($d['mday'] << 16) |
($d['hours'] << 11) | ($d['minutes'] << 5) | ($d['seconds'] >> 1);
}