aboutsummaryrefslogtreecommitdiffstats
path: root/now.pl
diff options
context:
space:
mode:
Diffstat (limited to 'now.pl')
-rw-r--r--now.pl13
1 files changed, 11 insertions, 2 deletions
diff --git a/now.pl b/now.pl
index 824dcc8f..0626779f 100644
--- a/now.pl
+++ b/now.pl
@@ -1,7 +1,16 @@
#!/usr/bin/perl
#ident "$Id$"
#
-# Print the time as a hexadecimal integer
+# Print the time (possibly the mtime of a file) as a hexadecimal integer
#
-printf "0x%08x\n", time;
+($file) = @ARGV;
+if ( defined($file) ) {
+ ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
+ $ctime,$blksize,$blocks) = stat($file);
+ $now = $mtime;
+} else {
+ $now = time;
+}
+
+printf "0x%08x\n", $now;