X-Git-Url: https://git.donarmstrong.com/?p=bin.git;a=blobdiff_plain;f=make_invoice;h=0047d45079b0544e92a4c1121489629ad1c55a02;hp=5f87df414c6758c2dbdaae96a216eba74f718814;hb=HEAD;hpb=381daee1720ade751b5342b972912f94a6cc1f76 diff --git a/make_invoice b/make_invoice index 5f87df4..0047d45 100755 --- a/make_invoice +++ b/make_invoice @@ -176,6 +176,7 @@ while (<$log_fh>) { chomp; next if /^Total: \d+\.\d{2}$/; if (/^\s*\* /) { + print STDERR $_."\n"; if (defined $time) { $tex_log .= format_events(date => $date, date2 => $date2, @@ -188,13 +189,19 @@ while (<$log_fh>) { } s/\s*\[[\.\d]+\]\s*\[[\.\d]+\]\s*$//; my ($d1,$d2); - if (/\s*\*\s*CLOCK:\s+\[([^\]]+)\]--\[([^\]]+)\]/) { + if (/\s*\*\s*CLOCK:\s+\[([^\]]+)\]--\[([^\]]+)\]/ or + /^\s*\*\s*(.+)?\s* - \s*(.+)?\s*$/ + ) { $d1 = UnixDate(ParseDate($1),'%s'); $d2 = UnixDate(ParseDate($2),'%s'); + if (not defined $d1) { + die "Invalid date: $1"; + } + if (not defined $d2) { + die "Invalid date: $2"; + } } else { - ($d1,$d2) = map {s/^\s*\*\s*//; - UnixDate(ParseDate($_),'%s') - } split /\s*-\s*/; + die "malformed line $_"; } my $string = '* '.strftime('%A, %B %e, %H:%M:%S',localtime($d1)).' - '. strftime('%A, %B %e, %H:%M:%S',localtime($d2));