about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchMsg.pm
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-04-05 21:45:28 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-04-06 21:18:38 +0000
commit936670cb83971bf250571a7dd9b0a0a0b33babd8 (patch)
tree675fa79206f5c1e9f3a13052ddd9d28b69fa67ca /lib/PublicInbox/SearchMsg.pm
parent9d6468d9560b8cd26ba2529d7a09a93ec5ad8c00 (diff)
downloadpublic-inbox-936670cb83971bf250571a7dd9b0a0a0b33babd8.tar.gz
Dscho found this useful for finding matching git commits based
on AuthorDate in git.  Add it to the overview DB format, too;
 so in the future we can support v2 repos without Xapian.

https://public-inbox.org/git/nycvar.QRO.7.76.6.1804041821420.55@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz
https://public-inbox.org/git/alpine.DEB.2.20.1702041206130.3496@virtualbox/
Diffstat (limited to 'lib/PublicInbox/SearchMsg.pm')
-rw-r--r--lib/PublicInbox/SearchMsg.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/PublicInbox/SearchMsg.pm b/lib/PublicInbox/SearchMsg.pm
index d43853a0..3278802b 100644
--- a/lib/PublicInbox/SearchMsg.pm
+++ b/lib/PublicInbox/SearchMsg.pm
@@ -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;