aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/timestamp.pl
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2006-04-20 00:25:17 +0000
committerFelix Fietkau <nbd@openwrt.org>2006-04-20 00:25:17 +0000
commit665ed0f72c5b43297d1080723b7c55b14dbe57d2 (patch)
treec232e827ef60459a14289f5c31bbdeadebe3e884 /scripts/timestamp.pl
parentf6f968ee7d62445428d582ddeb902252e478bb59 (diff)
downloadmaster-187ad058-665ed0f72c5b43297d1080723b7c55b14dbe57d2.tar.gz
master-187ad058-665ed0f72c5b43297d1080723b7c55b14dbe57d2.tar.bz2
master-187ad058-665ed0f72c5b43297d1080723b7c55b14dbe57d2.zip
add timestamp check script
git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@3677 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'scripts/timestamp.pl')
-rwxr-xr-xscripts/timestamp.pl40
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/timestamp.pl b/scripts/timestamp.pl
new file mode 100755
index 0000000000..f6b06bc7f3
--- /dev/null
+++ b/scripts/timestamp.pl
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+use strict;
+
+sub get_ts($) {
+ my $path = shift;
+ my $ts = 0;
+ open FIND, "find $path -not -path \\*.svn\\* -and -not -path \\*CVS\\* |";
+ while (<FIND>) {
+ open FILE, "<$_";
+ my @stat = stat FILE;
+ close FILE;
+ $ts = $stat[9] if ($stat[9] > $ts);
+ }
+ close FIND;
+ return $ts;
+}
+
+(@ARGV > 0) or push @ARGV, ".";
+my $ts = 0;
+my $n = ".";
+my %options;
+foreach my $path (@ARGV) {
+ if ($path =~ /^-/) {
+ $options{$path} = 1;
+ } else {
+ my $tmp = get_ts($path);
+ if ($tmp > $ts) {
+ $n = $path;
+ $ts = $tmp;
+ }
+ }
+}
+
+if ($options{"-p"}) {
+ print "$n\n";
+} elsif ($options{"-t"}) {
+ print "$ts\n";
+} else {
+ print "$n\t$ts\n";
+}