+### get time period
+my ($StartMonth,$EndMonth);
+# if '-a' is set, set start/end month from database
+# FIXME - it doesn't make that much sense to get first/last month from database to query it
+# with a time period that equals no time period ...
+if ($Options{'a'}) {
+ undef($Options{'m'});
+ undef($Options{'p'});
+ my $DBQuery = $DBHandle->prepare(sprintf("SELECT MIN(month),MAX(month) FROM %s.%s",$Conf{'DBDatabase'},$Conf{'DBTableGrps'}));
+ $DBQuery->execute or die sprintf("$MySelf: E: Can't get MIN/MAX month from %s.%s: %s\n",$Conf{'DBDatabase'},$Conf{'DBTableGrps'},$DBI::errstr);
+ ($StartMonth,$EndMonth) = $DBQuery->fetchrow_array;
+} else {
+ ($StartMonth,$EndMonth) = &GetTimePeriod($Options{'m'},$Options{'p'});
+};
+# if time period is more than one month: set output type to '-o pretty' or '-o dumpgroup'
+if ($Options{'o'} eq 'dump' and ($Options{'p'} or $Options{'a'})) {
+ if (defined($Options{'n'}) and $Options{'n'} !~ /:|\*/) {
+ # just one newsgroup is defined
+ warn ("$MySelf: W: You cannot combine time periods (-p) with '-o dump', changing output type to '-o dumpgroup'.\n");
+ $Options{'o'} = 'dumpgroup';
+ } elsif (!defined($Options{'f'})) {
+ # more than one newsgroup - and no file output
+ warn ("$MySelf: W: You cannot combine time periods (-p) with '-o dump', changing output type to '-o pretty'.\n");
+ $Options{'o'} = 'pretty';
+ }
+};
+