Article View: news.software.nntp
Article #92381Re: INN laxmid clarification
From: Colin Macleod
Date: Sun, 31 Aug 2025 16:58
Date: Sun, 31 Aug 2025 16:58
37 lines
3999 bytes
3999 bytes
=?UTF-8?Q?Julien_=C3=89LIE?= <iulius@nom-de-mon-site.com.invalid> posted:
>
> Wouldn't it be possible to somehow rewrite the Date header field before
> injecting the article? (The old one could be kept in an X-Date header
> field.) There may be news readers that are unable to parse them too.
>
> In Python:
>
> >>> from email.utils import format_datetime,parsedate_to_datetime
> >>> format_datetime(parsedate_to_datetime("Wed, 31-Dec-69 18:59:59 EDT"))
> 'Wed, 31 Dec 1969 18:59:59 -0400'
I ran into similar problems with dates while loading historical posts from
archive.org into a database for my Newsgrouper site.
I was converting dates into Unix seconds format for ease of indexing/
searching/sorting. Since my code is in Tcl I was using its /clock scan/
for this - https://www.tcl-lang.org/man/tcl9.0/TclCmd/clock.html#M10 .
But I hit lots of dates that this failed with, and gradually built up a
collection of hacks to massage the input into a form it would accept.
These can be seen in proc parse_art, lines 132-146 of
https://chiselapp.com/user/cmacleod/repository/newsgrouper/file?udc=1&ln=on&ci=tip&name=scripts%2Fdb_load_arch
plus the timezone mappings at lines 110-124.
Note that /clock scan/ in Tcl9 is more strict by default, rejecting dates
like June 31, which did occur in the input. Tcl8 would accept these, /clock/
in Tcl9 will revert to the old behaviour with the option /-validate 0/ .
Converting back from unix seconds to an acceptable form for a Date header
can be done with:
[clock format $dat -format {%a, %d %b %Y %H:%M:%S GMT} -gmt true]
--
Colin Macleod ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ https://cmacleod.me.uk
FEED FEED FEED FEED FEED FEED FEED FEED
GAZA GAZA GAZA GAZA GAZA GAZA GAZA GAZA
NOW! NOW! NOW! NOW! NOW! NOW! NOW! NOW!
Technical Details
Message-ID:
<1756659485-7@newsgrouper.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.pugleaf.net!ygg-srl.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!eternal-september.org!feeder.eternal-september.org!newsgrouper.org!.POSTED!not-for-mailReferences:
<u90srm$2mhb$1@nnrp.usenet.blueworldhosting.com> <108v6jk$vqr6$1@news.trigofacile.com> <108vc8u$nji$1@nnrp.usenet.blueworldhosting.com> <87ms7g7jvb.fsf@hope.eyrie.org> <108vhqb$1nrv$1@nnrp.usenet.blueworldhosting.com> <108vuvv$11j2t$1@news.trigofacile.com>Show Full Headers
Complete Article Headers
Message-ID: <1756659485-7@newsgrouper.org>
Subject: Re: INN laxmid clarification
Date: Sun, 31 Aug 2025 16:58:05 GMT
From: Colin Macleod <user7@newsgrouper.org.invalid>
References: <u90srm$2mhb$1@nnrp.usenet.blueworldhosting.com> <108v6jk$vqr6$1@news.trigofacile.com> <108vc8u$nji$1@nnrp.usenet.blueworldhosting.com> <87ms7g7jvb.fsf@hope.eyrie.org> <108vhqb$1nrv$1@nnrp.usenet.blueworldhosting.com> <108vuvv$11j2t$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.pugleaf.net!ygg-srl.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!eternal-september.org!feeder.eternal-september.org!newsgrouper.org!.POSTED!not-for-mail
Newsgroups: news.software.nntp
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: newsgrouper.org; mail-complaints-to="newsgrouper@yahoo.com"; posting-account=user7
Injection-Date: Sun, 31 Aug 2025 16:58:05 GMT
User-Agent: Newsgrouper/0.8.1
Organisation: shmorganisation
X-Face: ;>4')~8UD=d.R[\.@A;)N{u_j#_=cmLx$}bIc4.3By~hf[q~|cf59?%bLtS)G@w#32G1%7y
kz`PF}nwv'neqs,&gJm|V!,Xuekf[YIYQB7[Px"t#|rqb20(<F+y~
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAWlBMVEUOqj99lWv/gSb8+vzH
yfDKcKfawMf/wXL/xwX/0DL/4MgAnuf////woTuJAg9haNWbJVrmDRbf8/wXqt0wOcfWPknT
or8xStFls+AyPs/XiXvV447V5/JsPbGdJXGAAAAByElEQVRIie2V0XqDIAyFqaGoaKWztSDi
+7/mkkoVFLbuonfLTeUzP+ckNMjaPwb7Bz4CcB+uh/eA0YdWSvE3mBW4Y4zKvW+JG6XGu+p/
BYJnMHrkwVrYYbDyB6AFNap1Ie3XMwaZB1oEXnWLAXPtQEikEgNmBWh7C6SDTCGzwN0DmD+I
l7WiKErIAHoBRNcF1iURGaC5EQDXrgt9EyFTANwaQ7+PrrPRRnKTSAEocN39ScqigDwg9gJP
QOYBG1fwDrB3lLPU5wC4FJcU4JqGJy1Bpku8aWggjkXLzDngudE8HNtaro7iefDndvBEjsBx
x40xIcCXEtDT9SpiR1YprTXNcQh4Rxjn+bxNt+NK08yPd7ooAgB7ZPyjQGIxDc9sjamGrqK+
DwCz9OgZj5kIcI8zbq3nk0jMQyCAG5+RwJjnWRm79SgAACsIbiUiZoJEj8dctkdAMLYJEPFA
AUFbTEVqpuHEWPoSg7qq4QigwJTMb8uqSl0zWQFZVXW49oBj7JQzFAm8AHSUvrjRUGzVAxNj
yW8D5tfxiw0Qbj9mUqKfejdLmyWsYon6FVV1zA/b6uNUbVGXB6PrSfdi8gqlFygnmajr89/p
b4k/bLhxPQ+xAAAAAElFTkSuQmCC