🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #165138

[slrn] problem with convdate.sl (was: Re: Xnews not reading articles)

#165138
From: DC
Date: Sun, 10 Apr 2005 21:14
104 lines
4346 bytes
Blinky the Shark wrote:
> DC wrote:

>> Blinky the Shark wrote:

>> [...]

>>> Date: Sun, 10 Apr 2005 07:06:27 CST

>> The hell?  }:O)

> In the headers on that post that I see here, GMT is shown.


Sorry, I forgot that I am running a macro to convert to local time.
Strange, though, since as you said, I'm not in CST, but EST.


Your post:
Date: 10 Apr 2005 11:06:27 GMT

My post:
Date: 10 Apr 2005 11:15:58 GMT

I was actually wondering what you were doing up at 0415 in the morning.
}:O)

But, this raises an interesting problem.  My macro doesn't work
properly, for me.

Here it is, in all of it's glory (courtesy of Thomas Schultz):

http://tinyurl.com/46s7z

convdate.sl

#v+
define date_header_to_localtime ()
{
   variable
     article = article_as_string(),
     i = is_substr (article, "\n\n"),
     header = article[[0:i-1]], % seperate header and body
     body = article[[i:]];

   % remove continuation lines from the header
   while (str_replace (header, "\n ", " "))
     header = ();
   while (str_replace (header, "\n\t", " "))
     header = ();

   % convert the header to an array of strings
   header = strtok (header, "\n");

   % find and replace the date header
   for (i=0; i < length(header); i++)
     {
	!if (strncmp (header[i], "Date:", 5))
	  {
	     variable time, time_s;
	     variable days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
	     variable months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
				"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
	     time = datestring_to_unixtime(substr(header[i],7,-1));
	     time_s = localtime (time);
	     header[i] = Sprintf("Date: %s, %02d %s %d %02d:%02d:%02d CST",
				 days[time_s.tm_wday],
				 time_s.tm_mday,
				 months[time_s.tm_mon],
				 1900+time_s.tm_year,
				 time_s.tm_hour,
				 time_s.tm_min,
				 time_s.tm_sec,
				 7);
	  }
     }

   % join header to the body
   header = strjoin (header, "\n");
   article = strcat (header, "\n", body);

   % replace the selected article with our result
   replace_article (article);
}

!if (register_hook ("read_article_hook", "date_header_to_localtime"))
  message ("Warning: Could not register date_header_to_localtime" +
	   " for read_article_hook");
#v-

I gather from this that Thomas must be CST.  I can easily replace the
text CST for PST, but I'm wondering if the calculation/conversion to
local time is correct for me (EST).  I'm embarassed to say, I've never
noticed.  I need a conversion factor of 4/5, depending on DST.
Obviously, I don't read s-lang, so I wouldn't know how to edit this.

Anyone care to lend a hand?

Thanks.

-- 
DC              Linux RU #1000111011000111001

Customize Xnews - http://dcicons.fateback.com
Technical Details
Message-ID: <slrnd5j5ov.4gg.dcmoose@moosemeat.ca.INVALID>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!solnet.ch!solnet.ch!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <3a36e.48752$Sc7.19960@amsnews05.chello.com> <slrnd5hhh1.55t.no.spam@thurston.blinkynet.net> <zV66e.21447$pU2.17822@amsnews03-serv.chello.com> <slrnd5i25i.hh2.no.spam@thurston.blinkynet.net> <slrnd5i2ne.fl4.dcmoose@moosemeat.ca.INVALID> <slrnd5io25.5jc.no.spam@thurston.blinkynet.net>

Show Full Headers
Complete Article Headers
Message-ID: <slrnd5j5ov.4gg.dcmoose@moosemeat.ca.INVALID>
Subject: [slrn] problem with convdate.sl (was: Re: Xnews not reading articles)
Date: Sun, 10 Apr 2005 21:14:08 +0000
From: DC <dcmoose@myrealbox.com>
References: <3a36e.48752$Sc7.19960@amsnews05.chello.com> <slrnd5hhh1.55t.no.spam@thurston.blinkynet.net> <zV66e.21447$pU2.17822@amsnews03-serv.chello.com> <slrnd5i25i.hh2.no.spam@thurston.blinkynet.net> <slrnd5i2ne.fl4.dcmoose@moosemeat.ca.INVALID> <slrnd5io25.5jc.no.spam@thurston.blinkynet.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!solnet.ch!solnet.ch!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
Newsgroups: news.software.readers
Organization: http://dcicons.fateback.com
Lines: 104
X-Trace: individual.net 5BAIMB6e5VcYgN7stNVLHwBlrI945HwBgHUqtPsRZ9iY15LUc9
X-Operating-System: Mandrake Linux 10.0 (Kernel 2.6.3-7mdk)
X-Message-Flag: This message violates the USA PATRIOT Act (HR 3162),
 section 811(c). Intercepted by CARNIVORE/3.0
X-WebTV-Stationery: Standard; BGColor=black; TextColor=black
X-Face: 6k$Xf_V^i#2X;
 X~[=Ra6mGRtOw!^s%HmaNj1y5a>YCL"vEl.Jjbkww,E~kI&f[*w{j:$V6a2:LKbWg@+qt)3x"fqU\H_Fy5tk8h[Iq/XW~okpDvCa\E~!fb]{H4j@CxE<vL?4q9cxiK5;
 ZdpI@,Bk)(\e67mAw; L}WCZ/NYSX|R6Jj{omL6KT/$
User-Agent: slrn/0.9.8.1 (Linux)