[Users] Search for messages between timestamps
Paul Rolland (=?UTF-8?B?44Od44O844Or44O744Ot44Op44Oz?=)
rol at witbe.net
Wed Aug 22 17:17:33 CEST 2018
Hello,
On Wed, 22 Aug 2018 18:09:06 +0300
Removed GDPR <removed-gdpr at example.com> wrote:
> On Wed, 22 Aug 2018 11:22:10 +0100 Brian Morrison
> wrote:
>
> > There's a tool on Fedora called pdd, it can
> > calculate date ranges etc. You may be able to create
> > a script file that uses it and then call that as an
> > action.
>
> I couldn't find this tool on openSUSE but I wrote a
> simple bash script:
>
> ----------
> #!/bin/bash
>
> current=$(date -d "${1}" +%s)
> start=$(date -d "${2}" +%s)
> end=$(date -d "${3}" +%s)
>
> if [[ $current -ge $start && $current -le $end ]]; then
> exit 0
> fi
> exit 1
> ----------
>
> Then I used it in extended search:
>
> test "$HOME/bin/is-date-in-range %d 2018-08-01 2018-08-10"
>
> There are 2 issues I notice:
>
> 1. Messages from 2018-08-10 are not shown (there are 3
> of them in the folder)
If I read your code, you do:
end=$(date -d "2018-08-10" +%s)
This is likely to be considered as "2018-08-10 00:00:00" and not
"2018-08-10 23:59:59"...
sh-4.3$ date -d "2018-08-10" +%s
1533852000
sh-4.3$ date -d "2018-08-10 00:00:00" +%s
1533852000
Try:
> start=$(date -d "${2} 00:00:00" +%s)
> end=$(date -d "${3} 23:59:59" +%s)
> 2. It is quite slow. I am testing on a local (MH)
> folder with 491 messages (4.04Mb) and it takes 25
> seconds show the result consisting of 86 messages
> (639Kb).
Too many fork/exec ???
Paul
--
Paul Rolland E-Mail : rol(at)witbe.net
CTO - Witbe.net SA Tel. +33 (0)1 47 67 77 77
Les Collines de l'Arche Fax. +33 (0)1 47 67 77 99
F-92057 Paris La Defense RIPE : PR12-RIPE
LinkedIn : http://www.linkedin.com/in/paulrolland
Skype : rollandpaul
"I worry about my child and the Internet all the time, even though she's
too young to have logged on yet. Here's what I worry about. I worry that 10
or 15 years from now, she will come to me and say 'Daddy, where were you
when they took freedom of the press away from the Internet?'"
--Mike Godwin, Electronic Frontier Foundation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.claws-mail.org/pipermail/users/attachments/20180822/931e19e5/attachment.sig>
More information about the Users
mailing list