original commit: a943e41692a94267316c3f060a06a1d9b0992231
This commit is contained in:
Matthew Flatt 2002-12-30 12:19:11 +00:00
parent 88b3e4f18a
commit 3938165c8b
2 changed files with 18 additions and 3 deletions

View File

@ -44,7 +44,7 @@
|#
(define legal-formats
(list 'american 'chinese 'german 'indian 'irish 'julian 'iso-8601))
(list 'american 'chinese 'german 'indian 'irish 'julian 'iso-8601 'rfc822))
(define date-display-format
(make-parameter 'american
@ -142,6 +142,17 @@
(values
(list year "-" (add-zero (date-month date)) "-" (add-zero (date-day date)))
(list " " hour24 ":" minute ":" second))]
[(rfc822)
(values
(list (substring week-day 0 3) ", " day " " (substring month 0 3) " " year)
(list* " " hour24 ":" minute ":" second " "
(let* ([delta (date-time-zone-offset date)]
[hours (quotient delta 3600)]
[minutes (modulo (quotient delta 60) 60)])
(list
(if (negative? delta) "-" "")
(add-zero (abs hours))
(add-zero minutes)))))]
[else (error 'date->string "unknown date-display-format: ~s"
(date-display-format))])])
(apply string-append (if time?

View File

@ -1,6 +1,7 @@
(module head-unit mzscheme
(require (lib "unitsig.ss"))
(require (lib "unitsig.ss")
(lib "date.ss"))
(require "head-sig.ss")
@ -139,7 +140,10 @@
(define (standard-message-header from tos ccs bccs subject)
(let ([h (insert-field
"Subject" subject
empty-header)])
(insert-field
"Date" (parameterize ([date-display-format 'rfc822])
(date->string (seconds->date (current-seconds)) #t))
empty-header))])
;; NOTE: bccs don't go into the header; that's why
;; they're "blind"
(let ([h (if (null? ccs)