Commits

M6 KVM committed eaf6931

Code to process -T parameter (start,end dates).

Comments (0)

Files changed (2)

 
 Package: dlmlstat
 Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, perl, libmail-box-perl, libboolean-perl, libmongodb-perl
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, perl, libmail-box-perl, libboolean-perl, libmongodb-perl, perl-modules
 Description: Daybo Logic Mailing list analyser
  Interesting statistics about mailing lists, from processing a Maildir
 use Getopt::Std;
 use Data::Dumper;
 use boolean ':all';
+use Time::Local;
 use strict;
 use warnings;
 use diagnostics;
 {
 	my ( $RefTS, $OptT ) = @_;
 	#TODO: Split the dates here
+	my @dates;
+	return $RefTS unless ( $OptT );
+	@dates = split(m',', $OptT);
+	foreach my $date ( @dates ) {
+		my $dest = 'start';
+		if ( $date =~ m/^(\d{4})\-(\d{2})\-(\d{2})$/ ) {
+			my ( $year, $mon, $mday ) = ( $1, $2, $3 );
+			my $ts = timegm(
+				0, # sec
+				0, # min
+				0, # hour
+				$mday,
+				$mon,
+				$year
+			);
+			$dest = 'end' if ( $RefTS->{'start'} ); # Done start? Now to end
+			$RefTS->{$dest} = $ts;
+		} else {
+			die(sprintf("Invalid time, should match YYYY-MM-DD: %s\n", $date));
+		}
+	}
+	return $RefTS;
 }
 
 sub Main()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.