🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.vm.bug
Article #8812

Re: Problem with timezone in mail header

#8812
From: Thorbjoern Hansen
Date: Fri, 16 Apr 1993 09:14
95 lines
4466 bytes
>>>> I (THH) wrote in an earlier mail:

THH> Excuse me if this does not belong here, but I am not sure where
THH> it belongs...  I am using Emacs 18.59.1 and VM 5.33 (beta).

Now I am sure.  This is a bug in emacs's sendmail.el (or,
alternatively, SUNs date, but emacs should not depend on that).

THH> I have noticed that if I save my outgoing mail to a folder with
THH> "FCC", the "From" line looks like this:
THH> 
THH>   From thansen Tue Apr 13 13:57:52 MET DST 1993

RFC822 specifies that a time zone has the following format:

RFC> zone   =  "UT"  / "GMT"                ; Universal Time
RFC> 					    ; North American : UT
RFC> 	    /  "EST" / "EDT"                ;  Eastern:  - 5/ - 4
RFC> 	    /  "CST" / "CDT"                ;  Central:  - 6/ - 5
RFC> 	    /  "MST" / "MDT"                ;  Mountain: - 7/ - 6
RFC> 	    /  "PST" / "PDT"                ;  Pacific:  - 8/ - 7
RFC> 	    /  1ALPHA                       ; Military: Z = UT;
RFC> 					    ;  A:-1; (J not used)
RFC> 					    ;  M:-12; N:+1; Y:+12
RFC> 	    / ( ("+" / "-") 4DIGIT )        ; Local differential
RFC>                                             ;  hours+min. (HHMM)
RFC> 
RFC>      Time zone may be indicated in several ways.  "UT" is Univer-
RFC> sal  Time  (formerly called "Greenwich Mean Time"); "GMT" is per-
RFC> mitted as a reference to Universal Time.  The  military  standard
RFC> uses  a  single  character for each zone.  "Z" is Universal Time.
RFC> "A" indicates one hour earlier, and "M" indicates 12  hours  ear-
RFC> lier;  "N"  is  one  hour  later, and "Y" is 12 hours later.  The
RFC> letter "J" is not used.  The other remaining two forms are  taken
RFC> from ANSI standard X3.51-1975.  One allows explicit indication of
RFC> the amount of offset from UT; the other uses  common  3-character
RFC> strings for indicating time zones in North America.

This is the appropiate part of code in sendmail.el (in function
mail-do-fcc):

      (set-buffer tembuf)
      (erase-buffer)
      (call-process "date" nil t nil)
      (goto-char (point-min))
      (re-search-forward 
==>     "[0-9] \\([A-Za-z][A-Za-z ]*[A-Za-z]\\)[0-9 ]*$")
      (setq timezone (buffer-substring (match-beginning 1) (match-end 1)))
      (erase-buffer)
      (insert "\nFrom " (user-login-name) " "
              (current-time-string) "\n")
      ;; Insert the time zone before the year.
      (forward-char -1)
      (forward-word -1)
      (insert timezone " ")

Notice that the regexp will match too much.  Unfortunately, SUNs
"date" has the wrong format:

THH> This line is generated by sendmail.el by calling date, which gives
THH> (sparc, sun4, sunOS 4.1.1 R2) (this is, of course, not documented in
THH> date's man page...):
THH> 
THH>   Thu Apr 15 01:00:21 MET DST 1993

I have not found any possibility to get the time zone from the shell,
but localtime(3) can be used to get

     long tm_gmtoff;  /* offset from GMT in seconds */

so we could compute a time zone of the form +HHMM/-HHMM.

You might want to consider that for the next release of emacs.  I'll
just insert MET, MDT or whatever appropiate by hand.  If anyone has a
better solution, please tell me.

THH> I have been told to look up RFC 1036 and RFC 822.  Can anyone tell me
THH> where to get RFC's?  (Or mail them to me, if they can not be retrieved
THH> by ftp.)

They can be found at:

	ftp.denet.dk:/pub/rfc/
	ftp.nisc.sri.com:/rfc/

Thanks to Wim van Dorst <tgcpwd@urc.tue.nl> and Kim Hoeglund
<shotokan@diku.dk> for telling me exacly where to look (and more).

Regards,
	Thorbjoern
	
--
ThH, Thorbjoern Hansen, hansen@forwiss.uni-passau.de, thansen@diku.dk
You may write in German, Spanish, Swedish, Danish or even English.
I collect emacs lisp files.  Mail me (the name of) your favorite.
Technical Details
Message-ID: <9304160914.AA03223@garm.diku.dk>
Path: arc1-ca.pugleaf.net!gmd.de!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!uunet!wendy-fate.uu.net!bug-vm

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f6829,9793f0ddc38321d4,start
X-Google-Attributes: gidf6829,public
X-Google-ArrivalTime: 1993-04-16 02:23:57 PST
x-gateway: rodan.UU.NET from bug-vm to gnu.emacs.vm.bug; Fri, 16 Apr 1993 05:14:35 EDT
Date: Fri, 16 Apr 1993 11:14:21 +0200
Message-ID: <9304160914.AA03223@garm.diku.dk>
From: thansen@diku.dk (Thorbjoern Hansen)
Sender: thansen@diku.dk
Subject: Re: Problem with timezone in mail header
Newsgroups: gnu.emacs.vm.bug
Path: arc1-ca.pugleaf.net!gmd.de!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!uunet!wendy-fate.uu.net!bug-vm
Lines: 95