summaryrefslogtreecommitdiff
path: root/lisp/mail/mail-utils.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-07-07 17:55:55 +0000
committerRichard M. Stallman <rms@gnu.org>1993-07-07 17:55:55 +0000
commite6a4a267ff8b2d413820bb539dc144ec786967ed (patch)
treeffcc98b30fdc64bd104839ed4dd7b28ae5e6df3b /lisp/mail/mail-utils.el
parentf3098917470a2d15e9c243bf58ea2b22666e45b4 (diff)
downloademacs-e6a4a267ff8b2d413820bb539dc144ec786967ed.tar.gz
(mail-rfc822-time-zone, mail-rfc822-date): New fns.
Diffstat (limited to 'lisp/mail/mail-utils.el')
-rw-r--r--lisp/mail/mail-utils.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el
index 0d32fbe23fe..5f45ab00acd 100644
--- a/lisp/mail/mail-utils.el
+++ b/lisp/mail/mail-utils.el
@@ -211,6 +211,21 @@ If third arg ALL is non-nil, concatenate all such fields with commas between."
"\\|"
(substring labels (match-end 0))))))
labels)
+
+(defun mail-rfc822-time-zone (time)
+ (let* ((sec (or (car (current-time-zone time)) 0))
+ (absmin (/ (abs sec) 60)))
+ (format "%c%02d%02d" (if (< sec 0) ?- ?+) (/ absmin 60) (% absmin 60))))
+
+(defun mail-rfc822-date ()
+ (let* ((time (current-time))
+ (s (current-time-string time)))
+ (string-match "[^ ]+ +\\([^ ]+\\) +\\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\)" s)
+ (concat (substring s (match-beginning 2) (match-end 2)) " "
+ (substring s (match-beginning 1) (match-end 1)) " "
+ (substring s (match-beginning 4) (match-end 4)) " "
+ (substring s (match-beginning 3) (match-end 3)) " "
+ (mail-rfc822-time-zone time))))
(provide 'mail-utils)