This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge pull request #1563 from phproberto/unix2dostime

Add deleted & required _unix2DOSTime method
  • Loading branch information...
2 parents 5b61255 + 8760d63 commit ae4237679919439799a757a8f89cf0f268569385 @LouisLandry LouisLandry committed Oct 8, 2012
Showing with 27 additions and 0 deletions.
  1. +27 −0 libraries/joomla/archive/zip.php
@@ -538,6 +538,33 @@ private function _getFileData($key)
return '';
}
+ /**
+ * Converts a UNIX timestamp to a 4-byte DOS date and time format
+ * (date in high 2-bytes, time in low 2-bytes allowing magnitude
+ * comparison).
+ *
+ * @param int $unixtime The current UNIX timestamp.
+ *
+ * @return int The current date in a 4-byte DOS format.
+ * @since 11.1
+ */
+ protected function _unix2DOSTime($unixtime = null)
+ {
+ $timearray = (is_null($unixtime)) ? getdate() : getdate($unixtime);
+
+ if ($timearray['year'] < 1980)
+ {
+ $timearray['year'] = 1980;
+ $timearray['mon'] = 1;
+ $timearray['mday'] = 1;
+ $timearray['hours'] = 0;
+ $timearray['minutes'] = 0;
+ $timearray['seconds'] = 0;
+ }
+
+ return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1);
+ }
+
/**
* Adds a "file" to the ZIP archive.
*

0 comments on commit ae42376

Please sign in to comment.