Ok, so, that being said, I need the date to be as accurate as possible. However, after some tests I am finding that the mtime returned from stat() and then being converted to human readable format via Perl's built-in gmtime() that for some reason the month returned is one month off.
I find it more difficult to believe that there is something wrong with Perl versus something wrong with what I am doing. Please check my work and see if I am off somewhere.
First, I touch a file so I get the desired mtime that I am looking for. I check the mtime using a utility I wrote called macls. Here is the output...
MACtime for: "test_file_1_200008261030" Mode(-rw-r--r-- => 0644) gvc(2000) gvcadm(104) 0 bytes 0 blocks Modified time ........ Sat Aug 26 09:30:00 2000 Access time ........ Sat Aug 26 09:30:00 2000 Inode Change ........ Tue Jun 18 12:14:19 2002 ******************************************************* MACtime for: "test_file_2_199504231930" Mode(-rw-r--r-- => 0644) gvc(2000) gvcadm(104) 0 bytes 0 blocks Modified time ........ Sun Apr 23 18:30:00 1995 Access time ........ Sun Apr 23 18:30:00 1995 Inode Change ........ Tue Jun 18 12:14:39 2002 ******************************************************* MACtime for: "test_file_3_200506200200" Mode(-rw-r--r-- => 0644) gvc(2000) gvcadm(104) 0 bytes 0 blocks Modified time ........ Mon Jun 20 01:00:00 2005 Access time ........ Mon Jun 20 01:00:00 2005 Inode Change ........ Tue Jun 18 12:15:00 2002 Total files checked : 4 Total size in bytes : 0 Total size in Kbytes: 0K
Ok. Now, I now do the following:
For everyone who doesn't know, the first number is the day, the second number is the month and the third number is the year - 1900. Everything is fine except the month value. Its off by a month.perl -e 'open(F,"test_file_1_200008261030");$date = (stat(F))[9];@date + = (eval((gmtime($date))[3,4,5]));print "@date\n"' 26 7 100
What am I overlooking?
_
_
_
_
_
_
_
_
_
_
- Jim
Insert clever comment here...
In reply to built-in gmtime() returning one month off? by snafu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |