summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1f887bd)
While inspect is intended for debugging, the Unix epoch in
seconds requires extra steps for human consumption; just
steal what we used for "lei q -f json" output.
use PublicInbox::Config;
use PublicInbox::MID qw(mids);
use PublicInbox::NetReader qw(imap_uri nntp_uri);
use PublicInbox::Config;
use PublicInbox::MID qw(mids);
use PublicInbox::NetReader qw(imap_uri nntp_uri);
+use POSIX qw(strftime);
+use PublicInbox::LeiOverview;
+*iso8601 = \&PublicInbox::LeiOverview::iso8601;
sub _json_prep ($) {
my ($smsg) = @_;
$smsg->{$_} += 0 for qw(bytes lines); # integerize
sub _json_prep ($) {
my ($smsg) = @_;
$smsg->{$_} += 0 for qw(bytes lines); # integerize
+ $smsg->{dt} = iso8601($smsg->{ds}) if defined($smsg->{ds});
+ $smsg->{rt} = iso8601($smsg->{ts}) if defined($smsg->{ts});
+{ %$smsg } # unbless and scalarize
}
+{ %$smsg } # unbless and scalarize
}
# cf. https://en.wikipedia.org/wiki/JSON_streaming
my $JSONL = 'ldjson|ndjson|jsonl'; # 3 names for the same thing
# cf. https://en.wikipedia.org/wiki/JSON_streaming
my $JSONL = 'ldjson|ndjson|jsonl'; # 3 names for the same thing
-sub _iso8601 ($) { strftime('%Y-%m-%dT%H:%M:%SZ', gmtime($_[0])) }
+sub iso8601 ($) { strftime('%Y-%m-%dT%H:%M:%SZ', gmtime($_[0])) }
# we open this in the parent process before ->wq_io_do handoff
sub ovv_out_lk_init ($) {
# we open this in the parent process before ->wq_io_do handoff
sub ovv_out_lk_init ($) {
# num/tid are nonsensical with multi-inbox search,
# lines/bytes are not generally useful
delete @$smsg{qw(num tid lines bytes)};
# num/tid are nonsensical with multi-inbox search,
# lines/bytes are not generally useful
delete @$smsg{qw(num tid lines bytes)};
- $smsg->{rt} = _iso8601(delete $smsg->{ts}); # JMAP receivedAt
- $smsg->{dt} = _iso8601(delete $smsg->{ds}); # JMAP UTCDate
+ $smsg->{rt} = iso8601(delete $smsg->{ts}); # JMAP receivedAt
+ $smsg->{dt} = iso8601(delete $smsg->{ds}); # JMAP UTCDate
$smsg->{pct} = get_pct($mitem) if $mitem;
if (my $r = delete $smsg->{references}) {
$smsg->{refs} = [ map { $_ } ($r =~ m/$MID_EXTRACT/go) ];
$smsg->{pct} = get_pct($mitem) if $mitem;
if (my $r = delete $smsg->{references}) {
$smsg->{refs} = [ map { $_ } ($r =~ m/$MID_EXTRACT/go) ];