Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.tele2net.at!newsfeed.utanet.at!feeder1.cambriumusenet.nl!feed.tweaknews.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <1968307.IDv9frP7EL@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Sat, 25 Aug 2012 00:47:16 +0200 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. Followup-To: comp.lang.php MIME-Version: 1.0 Lines: 75 NNTP-Posting-Date: 25 Aug 2012 00:47:16 CEST NNTP-Posting-Host: c5f74511.newsspool3.arcor-online.net X-Trace: DXC=Q?OgT>c;JhDZm8W4\YJN`9Q1D[@@=HWk7 X-Complaints-To: usenet-abuse@arcor.de Xref: csiph.com comp.lang.php:6842 Vlatko Ć urlan wrote: > Pay attention to the different mtimes reported. > > vlatko@david:/tmp/mtimeTests$ php5 -v > PHP 5.3.3-7+squeeze14 with Suhosin-Patch (cli) (built: Aug 6 2012 > 20:08:59) Copyright (c) 1997-2009 The PHP Group > Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies > with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans > with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH > > vlatko@david:/tmp/mtimeTests$ ll > total 56 > -rw-r----- 1 vlatko vlatko 51946 Kol 23 19:01 img.jpg `stat img.jpg', which shows the milliseconds, would have been more helpful for diagnostics. > vlatko@david:/tmp/mtimeTests$ php5 -r 'echo filemtime("img.jpg") . "\n";' > ****1345741275**** > > vlatko@david:/tmp/mtimeTests$ php5 -r '$zip = new ZipArchive(); > $zip->open("test.zip", ZIPARCHIVE::CREATE); $zip->addFile("img.jpg"); > $zip->close();' > > vlatko@david:/tmp/mtimeTests$ php5 -r '$zip = new ZipArchive(); > $zip->open("test.zip"); print_r($zip->statIndex(0));' > [snip] > [mtime] => ****1345741274**** > [snip] > > vlatko@david:/tmp/mtimeTests$ zip update test.zip > adding: test.zip (stored 0%) This adds test.zip to the ZIP archive `update.zip'. It has nothing to do with the *mtime* of test.zip or the files in test.zip. > vlatko@david:/tmp/mtimeTests$ php5 -r '$zip = new ZipArchive(); > $zip->open("test.zip"); print_r($zip->statIndex(0));' > [snip] > [mtime] => ****1345741274**** > [snip] > > I detected this while trying to update a ZIP archive using PHP. Obviously > I tried to compare filemtime for each file with what ZipArchive reported > and realized that they are never the same. What is going on here? $ stat -c %Y test.txt 1270260799 $ php5 -r 'echo filemtime("test.txt") . "\n";' 1270260799 $ php5 -r '$zip = new ZipArchive(); $zip->open("test.zip", ZIPARCHIVE::CREATE); $zip->addFile("test.txt"); $zip->close();' $ php5 -r '$zip = new ZipArchive(); $zip->open("test.zip"); print_r($zip- >statIndex(0));' | grep mtime [mtime] => 1270260798 $ php5 --version PHP 5.3.10-1 (cli) (built: Feb 3 2012 10:03:01) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies with XCache v1.3.2, Copyright (c) 2005-2011, by mOo with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH The mtime with ZipArchive is behind by only one second after epoch. This might be caused by that mtime not taking into account UTC's leap seconds. PointedEars -- When all you know is jQuery, every problem looks $(olvable).