Explorar el Código

Print last update time/file

Zachary Kotlarek hace 13 años
padre
commit
11a30b18a3
Se han modificado 1 ficheros con 13 adiciones y 1 borrados
  1. 13 1
      dmx/debug.pl

+ 13 - 1
dmx/debug.pl

@@ -24,6 +24,18 @@ DMX::stateSocket($STATE_SOCK);
 DMX::stateSubscribe($STATE_SOCK);
 
 # Loop forever
+my %exists = ();
+my %mtime  = ();
 while (1) {
-	DMX::readState($DELAY, undef(), undef(), undef());
+	my $state = DMX::readState($DELAY, \%exists, \%mtime, undef());
+
+	if ($state) {
+		my $file = undef();
+		foreach my $key (keys(%mtime)) {
+			if (!defined($file) || $mtime{$key} > $mtime{$file}) {
+				$file = $key;
+			}
+		}
+		print STDERR "\tLast update: " . $file . ': ' . localtime($mtime{$file}) . "\n";
+	}
 }