<<< Date Index >>>     <<< Thread Index >>>

Re: Setting timezone to local timezone



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday, January 29 at 09:03 AM, quoth Stuart McKim:
> Is there a way to specify what timezone mutt uses for the "Date:" 
> header?

Yes.

> The server I am using is set correctly to UTC time, but I would like 
> the date to be shown as Pacific time (currently -0800). I would 
> really prefer to keep the server on UTC as it integrates better with 
> the rest of our infrastructure.

Sounds reasonable.

> I know that technically the date is correct, but for somebody using 
> an e-mail client that does not automatically convert dates to the 
> local time, such as mutt, it would be nice to show the local time of 
> the sender.

Wait, which do you want to do?

There are two senses in which the date header is used: in displaying 
date messages from other messages, and in sending out new messages.

Mutt SENDS the date in the local time. However, in order to do so, it 
must (obviously) be made aware of what the local time zone IS. You do 
this by setting the TZ environment variable. For example, in your 
case, you would set TZ to be "US/Pacific".

For DISPLAY of already sent messages, mutt DOES convert the date to 
local time for display in the *index* (it even respects your LC_TIME 
setting), but does NOT convert the date to local time for display when 
viewing the message. As before, when it does convert things, it relies 
on the TZ environment variable.

When you view the message, mutt does very little to obfuscate the 
headers as they appeared in the message. In some cases, it decodes 
them to the correct charset, and removes quotes where appropriate, but 
the rest is essentially unmodified from exactly what was sent.

You could change that yourself by creating a display filter. For 
example:

    #!/bin/bash
    # save the message to a file
    cat - > /tmp/timezoneconvert.$$
    # extract the date header
    thedate=$( awk '/^Date: / && !i { $1="" ; print $0 ; i=1}' )
    # convert to the current timezone (defined by TZ)
    thedate=$( date -d "$thedate" )
    # output the modified message
    awk "{ if (/^Date: /) print \"Date: $thedate\"; else print $0; }" \
        </tmp/timezoneconvert.$$
    # clean up
    rm /tmp/timezoneconvert.$$

~Kyle
- -- 
Hanging on to resentment is letting someone you despise live rent-free 
in your head.
                                                        -- Ann Landers
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!

iD8DBQFFvjDHBkIOoMqOI14RAnNmAKCbe6Wb/OyaxVjJ2pwjzHcfgho48gCfXmjh
y2kbk1eBACPpm6LPTEzHmNk=
=z3J1
-----END PGP SIGNATURE-----