Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: comparing 2 file time date stamps

by GrandFather (Saint)
on Nov 06, 2014 at 04:05 UTC ( [id://1106310]=note: print w/replies, xml ) Need Help??


in reply to Re^2: comparing 2 file time date stamps
in thread comparing 2 file time date stamps

Run:

use strict; use warnings; my $test1 = 'test1'; my $test2 = 'test2'; open my $fOut, '>', $test1; close $fOut; open $fOut, '>', $test2; close $fOut; print "$_: ", (stat $_)[9], "\n" for $test1, $test2; sleep 5; open $fOut, '>', $test2; close $fOut; print "$_: ", (stat $_)[9], "\n" for $test1, $test2;

and tell us what you get.

Perl is the programming world's equivalent of English

Replies are listed 'Best First'.
Re^4: comparing 2 file time date stamps
by craigt (Acolyte) on Nov 06, 2014 at 15:30 UTC
    GrandFather,

    Below are the results. Everything looks right. I am confused.

    I want to mention that I saw the following. I have a file with a dt stamp of 11/4 in dir 1. I make a copy of it expecting the same date. It changed the date to the same date of a file with the same name in directory 2. O no.

    initial dt stamp
    c:/Steep/USA Data/State/KY/KY3.gif: 1414863057
    c:/usr/www/steepusa/stage/KY/KY3.gif: 1414863057
    
    1 As string: Sat Nov  1 13:30:57 2014
    2 As string: Sat Nov  1 13:30:57 2014
    
    after 1st open and close
    c:/Steep/USA Data/State/KY/KY3.gif: 1415287289
    c:/usr/www/steepusa/stage/KY/KY3.gif: 1415287289
    
    1 As string: Thu Nov  6 10:21:29 2014
    2 As string: Thu Nov  6 10:21:29 2014
    
    30 sec wait - file 2 opened and closed again
    
    file 1 and 2 after file 2 open/close
    c:/Steep/USA Data/State/KY/KY3.gif: 1415287289
    c:/usr/www/steepusa/stage/KY/KY3.gif: 1415287319
    
    1 As string: Thu Nov  6 10:21:29 2014
    2 As string: Thu Nov  6 10:21:59 2014
    

      Ok, so stat is working as expected. In that case most likely the files do have the same modification date and for some reason your impression that the dates are different is incorrect.

      Perl is the programming world's equivalent of English
        GrandFather, the list of files presented to me by Windows 7 when I go into the stage directory is what I'm basing my impression on. The list shows that the date of files in the stage directory is not what stat is returning to me in my program and not the same as the like-named file in the KY directory.

        And I do reproduce this result for 12 file pairs of like-named files in these 2 directories in my application. It looks right in the code you suggested I do, but not in my application or the code Corion suggested I do or the javascript I did. I am confused. I not sure how to proceed.

        The dates of these 12 file pairs that I've chosen for diagnostic purposes are not the same as shown by the windows file list, but all the diags I've done (my app, what you and corion suggested, and the javasscript) show that the dates of the pairs are the same, the 2nd file (stage) having the date of the 1st (KY), or the 2nd file (stage directory) stamp is different but incorrect.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1106310]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-25 06:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found