--- loncom/lonnet/perl/lonnet.pm 2002/08/28 19:48:57 1.274 +++ loncom/lonnet/perl/lonnet.pm 2002/08/28 21:50:27 1.275 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.274 2002/08/28 19:48:57 albertel Exp $ +# $Id: lonnet.pm,v 1.275 2002/08/28 21:50:27 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2458,6 +2458,30 @@ sub dirlist { } } +# --------------------------------------------- GetFileTimestamp +# This function utilizes dirlist and returns the date stamp for +# when it was last modified. It will also return an error of -1 +# if an error occurs + +sub GetFileTimestamp { + my ($studentDomain,$studentName,$filename,$root)=@_; + $studentDomain=~s/\W//g; + $studentName=~s/\W//g; + my $subdir=$studentName.'__'; + $subdir =~ s/(.)(.)(.).*/$1\/$2\/$3/; + my $proname="$studentDomain/$subdir/$studentName"; + $proname .= '/'.$filename; + my @dir = &Apache::lonnet::dirlist($proname, $studentDomain, $studentName, + $root); + my $fileStat = $dir[0]; + my @stats = split('&', $fileStat); + if($stats[0] ne 'empty' && $stats[0] ne 'no_such_dir') { + return $stats[9]; + } else { + return -1; + } +} + # -------------------------------------------------------- Value of a Condition sub directcondval {