[rt-users] Displaying times in local user's timezone (worldwide support)?

Craig Ringer craig at 2ndquadrant.com
Wed Feb 13 08:19:28 EST 2013


On 02/13/2013 08:13 PM, Craig Ringer wrote:
>
> Am I missing something?

Yes, yes I am. Inevitably, as soon as I posted this message I noticed
that there's a timezone field in the user table, though it isn't exposed
in the UI and is defined as "varchar(50)" with no CHECK constraint, so
it's not exactly clear what's supposed to go in it.

perldoc RT::User says:

"Returns the current value of Timezone. (In the database, Timezone is
stored as varchar(50).)"

... which is totally uninformative.

I found a comment in Date.pm saying that:

        require Time::ParseDate;
        # the module supports only legacy timezones like PDT or EST...
        # so we parse date as GMT and later apply offset, this only
        # should be applied to absolute times, so compensate shift in NOW

suggesting that these timezones might be such legacy timezones. There's
just one wee problem with that: Those timezone acronyms are not unique.
EST for example can mean USA Eastern States Time or Australian Eastern
States Time. They are also DST-unaware, since there's a different TZ
acronym for DST timezones, eg EDT for USA Eastern Daylight Time. This is
why PostgreSQL has a config parameter used to decide which region
ambiguous offsets resolve to.

A look at the perldoc for Time::ParseDate suggests that it also
understands UTC offsets, which are at least unambiguous:

http://search.cpan.org/~muir/Time-modules-2003.0211/lib/Time/ParseDate.pm#Timezone_formats:
<http://search.cpan.org/%7Emuir/Time-modules-2003.0211/lib/Time/ParseDate.pm#Timezone_formats:>

but no support for modern timezone specs like Australia/Perth that
auto-adjust to DST based on tzdata rules.

The apparent lack of use of the timezone field within RT makes me wonder
if it's incomplete / non-working. I'll test it out quickly, but it's
hard to be confident in it when it's not exposed by default. Anyone have
comments/experiences? I'm not a a big Perl user, so I'm not sure what
the support for modern dates, offsets and timezones is like in Perl or
what alternatives there are to the 1999 Time::ParseDate module.

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130213/c133dd99/attachment.htm>


More information about the rt-users mailing list