1 (edited by zacek 2014-09-20 17:39:00)

Topic: Setting daylight saving time

==================== Required information ====
- iRedMail version: iRedAdmin-Pro-MySQL  1.8.2
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): iRedAdmin-Pro-MySQL  1.8.2
- Linux/BSD distribution name and version: Debian 7.0.6
- Related log if you're reporting an issue:
====

Hi all,
I'd like to ask you if there is any way how to set properly TIME which is shown in Web IRedAdmin interface - Admin Log, Sent Mails, Received Mails, etc...  In my case, there is timew shift -1H from real time. Our users ask me why there is 1H delay of their emails, which is not true at all...

Premise:  Our server time is correctly synchronized by ntp. I have applied "LOCAL_TIMEZONE = 'GMT+01:00'" in settings.py (timezone for Europe/Czech Republic). All emails have correct/real time stamp (seen in RounCube, Outlook and TB...)

I found there is probably problem with "daylight saving time". Actual time in Czech Republic during the summer time is shifted +1H from GTM+01. As a result, there is +2H shift from GTM.

Please give me know if there is any config file for controlling "daylight saving time" settings.
Or I have to do it manually in settings.py?

Thank you for answer.
Josef

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Setting daylight saving time

Hi Josef,

Sorry about this trouble. I'm not sure about "daylight saving time", maybe you can try to update LOCAL_TIMEZONE to another one to make it correct?

3

Re: Setting daylight saving time

Yes, I can update LOCAL_TIMEZONE in settings.py manually, but I will have to do it twice a year!

Another problem is that, there is no fix date for date changing. For ex. next time it will be on the last Sunday in October 2014 fom 2 to 3 a.m. Next one after this, will be....I'm several decades old smile and I cant still remember it. As you can see, its a little bit complicated system.

I think, better solution is to take the system time directly from server or from log file (mail.log?). It depends on the source of this web log resp. time which is shown here. Our server is controlled by ntpd, so time is every moment accurate, incl. daylight saving time shifts. Is there any other relation to mysql seting?

4

Re: Setting daylight saving time

Amavisd logs basic info of in/out emails in SQL database, and iRedAdmin-Pro reads them, including the timestamp. iRedAdmin-Pro doesn't read time from log FILE or system timezone setting.

Currently, i'm afraid i don't have good idea to handle this "daylight saving time", sorry.

5

Re: Setting daylight saving time

Hi zacek,

I did some basic research with Google, and here's patch for DST issue, could you help verify whether it works for you or not?
After you patched/modified file 'libs/ireddate.py' under iRedAdmin-Pro directory, please restart web serivce (Apache or Nginx), then check timestamps in iRedAdmin-Pro.

diff -r a5905c065566 libs/ireddate.py
--- a/libs/ireddate.py    Mon Sep 22 07:05:55 2014 +0800
+++ b/libs/ireddate.py    Mon Sep 22 08:35:44 2014 +0800
@@ -184,6 +184,11 @@
     # Convert original timestamp (with UTC timezone) to timestamp with
     # local timezone.
     ft = to_datetime_with_tzinfo(t, tzinfo=LOCAL_TIMEZONE)
+
+    # Check 'daylight saving time'
+    if time.localtime().tm_isdst:
+        ft += timedelta(seconds=3600)
+
     if ft:
         return ft.strftime(format)
     else:

6

Re: Setting daylight saving time

Great job!
I applied the patch and in my case it works perfectly. The time and date is now correct.
It will be nice to see this patch merged in to the next release of iRedMail.

Thank you.
Josef

7

Re: Setting daylight saving time

zacek wrote:

I applied the patch and in my case it works perfectly. The time and date is now correct.
It will be nice to see this patch merged in to the next release of iRedMail.

Glad to hear that. And yes if it works for you, we will merge it.
It would be great if you can give me feedback when the time (switch back to not DST) change again. Let's see whether it works or not.

8

Re: Setting daylight saving time

ZhangHuangbin wrote:

Glad to hear that. And yes if it works for you, we will merge it.
It would be great if you can give me feedback when the time (switch back to not DST) change again. Let's see whether it works or not.

Yes of course, I will report.
The time shift would be on Sunday 26. Oct. 2014 from 3 a.m. to 2 a.m. I'll check it in the morning. Then I'll write how it looks.

9

Re: Setting daylight saving time

OK, waiting for your feedback. Thanks. smile

10

Re: Setting daylight saving time

ZhangHuangbin wrote:

OK, waiting for your feedback. Thanks. smile

On Sunday  26. there was (CZ) time shift from 3:00 a.m. to 2:00 a.m.
Today I control time setting on our mail server and all log time stamps in the web mamangement look right.

So I think your patch is working well a can be merged to source code.
Once more thank you for help.

11

Re: Setting daylight saving time

Glad to hear that, and thanks for your feedback and help testing. smile