Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^5: comparing 2 file time date stamps ( Path::Tiny File::stat Time::Piece )

by GotToBTru (Prior)
on Nov 05, 2014 at 21:45 UTC ( [id://1106262]=note: print w/replies, xml ) Need Help??


in reply to Re^4: comparing 2 file time date stamps ( Path::Tiny File::stat Time::Piece )
in thread comparing 2 file time date stamps

Did you try removing the quotes around the file name variable? Run the following, verbatim, and post the results, verbatim. Where I have the ???, fill in the path and name of one of your files.

use strict; use warnings; use File::stat; use Time::localtime; my $file = ???; printf "%s: %s\n", $file, ctime(stat($file)->mtime);
1 Peter 4:10

Replies are listed 'Best First'.
Re^6: comparing 2 file time date stamps ( Path::Tiny File::stat Time::Piece )
by craigt (Acolyte) on Nov 06, 2014 at 02:34 UTC

    Your going to love this.

    Below is a result files from the examination of 12 files (base directory) with a similar file in a different (staging) directory. I ran this after I put your diagnostic suggestion in. The code is basically the same.

    I was excited because all the 1st and 2nd dates were different. However all the 2nd date time stamps are wrong. The date portion is right on one. I don't know were it got the 2nd dates. They make no sense.

    I'm not doing the copy in these tests, just examining the dates.

    When I reran this test, the file dates of each of the pairs were the same again. This is strange.

    Note: All first date time stamps are right.
    
    C:/Steep/USA Data/State/KY/KY2.gif
    C:/usr/www/steepusa/stage/KY/KY2.gif
    Wed Nov  5 19:52:00 2014
    Wed Nov  5 13:09:08 2014 wrong??? 11/4/2014
    2014115195200
    2014115130908
    
    C:/Steep/USA Data/State/KY/ef.gif
    C:/usr/www/steepusa/stage/KY/ef.gif
    Wed Nov  5 19:34:36 2014
    Mon Nov  3 10:49:15 2014 wrong??? actually 8/25/2012
    2014115193436
    2014113104915
    
    C:/Steep/USA Data/State/KY/KYfv.gif
    C:/usr/www/steepusa/stage/KY/KYfv.gif
    Wed Nov  5 19:54:05 2014
    Wed Nov  5 13:09:41 2014 wrong??? 8/25/2012
    2014115195405
    2014115130941
    
    C:/Steep/USA Data/State/KY//cprofs.gif
    C:/usr/www/steepusa/stage/KY/cprofs.gif
    Wed Nov  5 19:58:00 2014
    Tue Sep 30 07:32:58 2014 Date is right.  Time is wrong.  
    2014115195800
    2014930073258
    
    C:/Steep/USA Data/State/KY/Ideals/Health/Healthfv.gif
    C:/usr/www/steepusa/stage/KY/Healthfv.gif
    Wed Nov  5 18:18:20 2014
    Thu May 24 13:36:42 2012 wrong??? 8/25/2012
    2014115181820
    2012524133642
    
    C:/Steep/USA Data/State/KY/KY.gif
    C:/usr/www/steepusa/stage/KY/KY.gif
    Wed Nov  5 19:51:52 2014
    Wed Nov  5 13:08:57 2014 wrong??? 11/4/2014
    2014115195152
    2014115130857
    
    C:/Steep/USA Data/State/KY/kyseal.gif
    C:/usr/www/steepusa/stage/KY/kyseal.gif
    Wed Nov  5 19:54:15 2014
    Fri Aug 17 10:35:10 2012 wrong??? 8/25/2012
    2014115195415
    2012817103510
    
    C:/Steep/USA Data/State/KY/kyflag.gif
    C:/usr/www/steepusa/stage/KY/kyflag.gif
    Wed Nov  5 19:52:19 2014
    Tue Nov  4 17:03:34 2014 wrong??? 8/25/2012
    2014115195219
    2014114170334
    
    C:/Steep/USA Data/State/KY/oldkyhome.gif
    C:/usr/www/steepusa/stage/KY/oldkyhome.gif
    Wed Nov  5 19:58:17 2014
    Fri Aug 17 10:35:11 2012 wrong??? 8/25/2012
    2014115195817
    2012817103511
    
    C:/Steep/USA Data/State/KY/kybird.gif
    C:/usr/www/steepusa/stage/KY/kybird.gif
    Wed Nov  5 19:52:08 2014
    Wed Nov  5 13:09:25 2014 wrong??? 8/25/2012
    2014115195208
    2014115130925
    
    C:/Steep/USA Data/State/KY/kyflower.gif
    C:/usr/www/steepusa/stage/KY/kyflower.gif
    Wed Nov  5 19:53:56 2014
    Fri Aug 17 10:35:10 2012 wrong??? 8/25/2012
    2014115195356
    2012817103510
    
    C:/Steep/USA Data/State/KY/kytree.gif
    C:/usr/www/steepusa/stage/KY/kytree.gif
    Wed Nov  5 19:54:26 2014
    Mon Nov  3 10:46:31 2014 wrong??? 8/25/2012
    2014115195426
    2014113104631
    
      Hmm, ctime again, stop using ctime , ok? All you've proved is some mystery version of Time::localtime ain't working to your satisfaction ... compare the raw number cause they're easily comparable they're raw numbers
Re^6: comparing 2 file time date stamps ( Path::Tiny File::stat Time::Piece )
by craigt (Acolyte) on Nov 05, 2014 at 23:25 UTC
    I think that work. I have to do some more testing. I thought I tried ctime and got the same result. Thanks for prodding me again.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-03-29 08:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found