Ticket #489 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 years ago

Adjust time display based on timezone

Reported by: dmorton Owned by: rjl
Priority: normal Milestone: 1.0.3
Component: General Version: 1.0.2
Severity: normal Keywords:
Cc:

Description

Chris Paul write:

It makes a lot of sense I think to have a time zone configuration setting
under Settings. This would specify an offset from the mail servers timezone which 
users could set to have their quarantine display mail items with the local time. It 
could be per-domain and inherited down to the user. It would probably also be a good 
idea to recommend that Maia servers (mail servers, web servers, etc) be set to UTC, 
since the standard and most logical way to offset local time is from UTC.

As noted in email,

The real question I have is one of performance: when do we make the adjustment? If we make it before being stored in the database, it might have ramifications for other processes. If we make the adjustment on every view, it could slow down the view. OTOH, it is stored in a datetime in sql, so it should be a very simple sql adjustment.

It looks like mysql has support:

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_convert-tz

And it appears, postgresql:

http://www.postgresql.org/docs/8.0/static/functions-datetime.html#FUNCTIONS-DATETIME-ZONECONVERT

This would require a user setting for their own timezone, so it is slated for maia 1.1 at the earliest.

Change History

Changed 3 years ago by dmorton

  • type changed from defect to enhancement

Changed 2 years ago by rjl

  • status changed from new to closed
  • resolution set to fixed

Ultimately I chose a much simpler implementation for [1231]. Rather than figuring out time zones and daylight savings time details, we just compare the system clocks on the server and the client to determine the offset (in seconds) between them, and then add that offset to the received_date timestamp in the SELECT statement used to produce the cache lists. No user settings are required--it's completely transparent. The offset is determined automatically during the login process and stored as a session variable.

Changed 2 years ago by dmorton

  • milestone changed from 1.1.0 to 1.0.3

retargetting for 1.0.3

Changed 2 years ago by rjl

Two small additions:

In [1261] a small typo is corrected in the PostgreSQL code;

In [1286] we no longer make any assumptions about whether the time stored in the system clocks is local or UTC. Instead we convert both times to UTC before determining the offset between the server time and the client time. This is necessary for systems which store UTC on their system clocks but use the operating system to track time zone offsets separately.

Changed 2 years ago by rjl@…

In [1297] we correct the subtraction order for the offset, such that it's server - client, rather than client - server.

Note: See TracTickets for help on using tickets.