]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SearchMsg.pm
search: index and allow searching by date-time
[public-inbox.git] / lib / PublicInbox / SearchMsg.pm
index d43853a0ac6a5c5515a27950051ed02a1af3f65b..3278802b8b6c683e7ec9627be52d1048fe3f2594 100644 (file)
@@ -9,6 +9,7 @@ use warnings;
 use PublicInbox::MID qw/mid_clean mid_mime/;
 use PublicInbox::Address;
 use PublicInbox::MsgTime qw(msg_timestamp msg_datestamp);
+use Time::Local qw(timegm);
 
 sub new {
        my ($class, $mime) = @_;
@@ -44,7 +45,6 @@ sub to_doc_data {
                $self->cc,
                $oid,
                $mid0,
-               $self->ds,
                $self->{bytes},
                $self->{lines}
        );
@@ -65,7 +65,6 @@ sub load_from_data ($$) {
 
                $self->{blob},
                $self->{mid},
-               $self->{ds},
                $self->{bytes},
                $self->{lines}
        ) = split(/\n/, $_[1]);
@@ -75,7 +74,10 @@ sub load_expand {
        my ($self) = @_;
        my $doc = $self->{doc};
        my $data = $doc->get_data or return;
-       $self->{ts} = get_val($doc, &PublicInbox::Search::TS);
+       $self->{ts} = get_val($doc, PublicInbox::Search::TS());
+       my $dt = get_val($doc, PublicInbox::Search::DT());
+       my ($yyyy, $mon, $dd, $hh, $mm, $ss) = unpack('A4A2A2A2A2A2', $dt);
+       $self->{ds} = timegm($ss, $mm, $hh, $dd, $mon - 1, $yyyy);
        utf8::decode($data);
        load_from_data($self, $data);
        $self;