Timezone Help Needed

Hi Folks,

I’m getting weird timestamps in rt2 (running on Linux RH8). I’m in Auckland,
New Zealand (GMT +12). I have set the timezone setting in config.pm to
’NZDT’, which I believe linux understands (at least “date” returns in NZDT,
eg Tue Nov 26 09:43:12 NZDT 2002) but in RT the timestamp seems to be for
GMT.

I have the linux box getting the local time from a timeserver here in New
Zealand and turned the UTC option off in the RH Date & Time settings.

I’ve played around a bit but it never seems to get the right time.

I’m getting weird timestamps in rt2 (running on Linux RH8). I’m in Auckland,
New Zealand (GMT +12). I have set the timezone setting in config.pm to
’NZDT’, which I believe linux understands (at least “date” returns in NZDT,
eg Tue Nov 26 09:43:12 NZDT 2002) but in RT the timestamp seems to be for
GMT.

You’re referring to things like the Search page displaying dates in GMT
(eg: Search Criteria … Created > 2002-07-31 22:00:00 GMT), yes?

RT will always store dates in GMT/UTC format, and you really don’t want
to change the storage of the dates.

However, the presentation of the dates during a search, thats another
matter. The RT::Date->AsString() method returns dates in the local
timezone, so we could change the descriptive text for the search criteria.

After a little poking around, we see that /Search/Listing.html relies on
RT::Tickets->DescribeRestrictions(). Another bit of poking around shows
that this is the only reference to the call, and the text stored in the
RT::Tickets object is used only by humans.

So, lets look at where that field is set. Obviously, its in
RT::Tickets->LimitDate, where we see that we’re setting the DESCRIPTION
manually, ie:

unless ($args{'DESCRIPTION'} ) {
    $args{'DESCRIPTION'} = $args{'FIELD'} . " " .$args{'OPERATOR'}. " ". $args{'VALUE'} . " GMT"
}

Note the GMT on the end. What we want to do is to show the date in the
local timezone. Since RT has a nice RT::Date object that we can use, we
don’t need to do date manipulations ourselves:

unless ($args{'DESCRIPTION'} ) {
# Create a RT::Date object.
    my $tdate = RT::Date->new( $RT::SystemUser );

# Set it to the specific time.
    $tdate->Set(    Format => 'ISO',
                    Value => $args{'VALUE'} );

# The old line commented out.
    # $args{'DESCRIPTION'} = $args{'FIELD'} . " " .$args{'OPERATOR'}. " ". $args{'VALUE'} . " GMT"

    # If we use AsString, we get it in the localtimezone.
    $args{'DESCRIPTION'} = $args{'FIELD'} . " " .$args{'OPERATOR'}. " ". $tdate->AsString() . " " . $tdate->LocalTimezone();
}

Note that you will need to set $Timezone in etc/config.pm to be
something that your machine recognises. After editing it, you will need
to stop and then start your apache instance to flush the mod_perl cache
and have changes be visible.

Regards,

                         Bruce Campbell                            RIPE
               Systems/Network Engineer                             NCC
             www.ripe.net - PGP562C8B1B             Operations/Security

I’m getting weird timestamps in rt2 (running on Linux RH8). I’m in Auckland,
New Zealand (GMT +12). I have set the timezone setting in config.pm to
’NZDT’, which I believe linux understands (at least “date” returns in NZDT,
eg Tue Nov 26 09:43:12 NZDT 2002) but in RT the timestamp seems to be for
GMT.

You’re referring to things like the Search page displaying dates in GMT
(eg: Search Criteria … Created > 2002-07-31 22:00:00 GMT), yes?

RT will always store dates in GMT/UTC format, and you really don’t want
to change the storage of the dates.

Bruce,

Have you figured out a way to avoid having to convert times 

from $LOCALTIME to GMT every time you want to search by time?

Best Regards,
Camron

Camron W. Fox
Hilo Office
High Performance Computing Group
Fujitsu America, Inc.
Email: cwfox@fujitsu.com
Phone: +1 (808) 934-4102
Cell: +1 (808) 937-5026
Fax: +1 (808) 934-4122

I’m getting weird timestamps in rt2 (running on Linux RH8). I’m in Auckland,
New Zealand (GMT +12). I have set the timezone setting in config.pm to
’NZDT’, which I believe linux understands (at least “date” returns in NZDT,
eg Tue Nov 26 09:43:12 NZDT 2002) but in RT the timestamp seems to be for
GMT.

You’re referring to things like the Search page displaying dates in GMT
(eg: Search Criteria … Created > 2002-07-31 22:00:00 GMT), yes?

RT will always store dates in GMT/UTC format, and you really don’t want
to change the storage of the dates.

Have you figured out a way to avoid having to convert times
from $LOCALTIME to GMT every time you want to search by time?

As per my previous mail, the conversion is needed every time as RT stores
dates in GMT internally. You really don’t want to change the storage of
dates within RT. If you do want to change this, keep in mind that you
then have to deal with daylight savings time adjustments yourself, rather
than letting your system deal with it as part of time conversion.

As per my previous mail, the display of dates in the search page is
currently in GMT, probably due to a small oversight.

As per my previous mail, you can change a small section of code which puts
the human-readable description of a date-dependent search into your local
timezone, if RT knows what your local timezone.

What was not in my previous mail, but I’m sure that you have found out by
experimentation, is that RT accepts date input (in the search page) in the
local timezone, and just displays the equivilant time in GMT .

Regards,

                         Bruce Campbell                            RIPE
               Systems/Network Engineer                             NCC
             www.ripe.net - PGP562C8B1B             Operations/Security

Hi Folks,

I’m getting weird timestamps in rt2 (running on Linux RH8). I’m in Auckland,
New Zealand (GMT +12). I have set the timezone setting in config.pm to
’NZDT’, which I believe linux understands (at least “date” returns in NZDT,
eg Tue Nov 26 09:43:12 NZDT 2002) but in RT the timestamp seems to be for
GMT.

I have the linux box getting the local time from a timeserver here in New
Zealand and turned the UTC option off in the RH Date & Time settings.

I’ve played around a bit but it never seems to get the right time.

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

Content-Type: text/plain; charset=us-ascii

In message BA08F5B8.258F%greg.elisara@realgroovy.co.nz, Greg Elisara writes:

I’m getting weird timestamps in rt2 (running on Linux RH8). I’m in Auckland,
New Zealand (GMT +12). I have set the timezone setting in config.pm to
’NZDT’, which I believe linux understands (at least “date” returns in NZDT,
eg Tue Nov 26 09:43:12 NZDT 2002) but in RT the timestamp seems to be for
GMT.

That almost definitely won’t work, as the Timezone setting needs more
information than NZDT. For Auckland, the RH8 setting should probably be
"Pacific/Auckland". If that doesn’t work, look for a directory on your
system called zoneinfo. Find the file under that directory that is correct
for your location, and put the path relative to the zoneinfo directory in
config.pm. I suggest Pacific/Auckland because on my machine there is a file
/usr/share/zoneinfo/Pacific/Auckland that contains the timezone settings for
Auckland, NZ.

Good luck!


Ted Cabeen http://www.pobox.com/~secabeen ted@impulse.net
Check Website or Keyserver for PGP/GPG Key BA0349D2 secabeen@pobox.com
"I have taken all knowledge to be my province." -F. Bacon secabeen@cabeen.org
"Human kind cannot bear very much reality."-T.S.Eliot cabeen@netcom.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)
Comment: Exmh version 2.5 07/13/2001

iD8DBQE+RCldoayJfLoDSdIRAtjPAKCeAmqhF4iss2iDdm6CcqgCi8pgsgCfWKo3
V8DjwsXaUrrX2OXE+ERs9ZY=
=Zf0k
-----END PGP SIGNATURE-----