आप मूल्यों की तुलना करना चाहते हैं, तो आप नंबर पर आप अदिश संदर्भ में localtime
से मिला है और inode परिवर्तन समय है कि आप stat
से प्राप्त कर सकते हैं का उपयोग करना चाहें:
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($filename);
जहां:
0 dev device number of filesystem
1 ino inode number
2 mode file mode (type and permissions)
3 nlink number of (hard) links to the file
4 uid numeric user ID of file's owner
5 gid numeric group ID of file's owner
6 rdev the device identifier (special files only)
7 size total size of file, in bytes
8 atime last access time in seconds since the epoch
9 mtime last modify time in seconds since the epoch
10 ctime inode change time in seconds since the epoch (*)
11 blksize preferred block size for file system I/O
12 blocks actual number of blocks allocated
तो आप चाहते हैं क्षेत्र 9:
$mtime = (stat $filename)[9];
$current_time = time;
$diff = $current_time - $mtime;
स्रोत
2008-12-29 11:21:58
: http://www.perl.com/doc/manual/html/pod/perlfunc/stat.html कैसे दिनांकों कन्वर्ट करने के लिए की – some
जानकारी: http://www.perl.com /pub/a/2003/03/13/datetime.html – some
आपके प्रश्न का उत्तर है: उन्हें उसी प्रारूप में कनवर्ट करें। मैं सुझाव देता हूं कि "आज, 2 9 दिसंबर, 2008" एक टाइमस्टैम्प (युग के बाद से (मिली) सेकंड की संख्या में परिवर्तित)। फिर यह दो संख्याओं की एक साधारण तुलना – some