Details
- 
    Type:Bug 
- 
    Status: Done/Fixed
- 
    Priority:Minor 
- 
    Resolution: Duplicate
- 
    Affects Version/s: 3.4.0, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.4.5, 3.4.6, 3.4.7, 3.4.8, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4, 4.0.5, 4.0.6, 4.0.7, 4.0.8
- 
    Fix Version/s: Unscheduled
- 
    Component/s: CiviMail
- 
    Labels:None
- 
        Versioning Impact:Patch (backwards-compatible bug fixes)
- 
        Documentation Required?:None
- 
        Funding Source:Needs Funding
Description
My instance of Civi 4.07 is hosted on a server whose clock is in a different timezone than my site's timezone. This has revealed something buggy about the way CiviMail handles time values.
Let's say I run a CiviMail mailing at 9AM in my site's timezone. In the database, a record is created in `civicrm_mailing_job` with `start_date` set to 9AM.
If someone opens the message immediately, a record is created in `civicrm_mailing_event_trackable_url_open`. BUT the `time_stamp` field in this record is set to 11AM!
So, on my installation, the mailing's start/end times display correctly. But all tracked opens and tracked clicks appear to have happened 2 hours later than they really did. (Delivery times are stored correctly. Not sure about Forwards or Bounces.)
I thought I could track this down. I looked in
CRM/Mailing/BAO/Job.php
and
CRM/Mailing/Event/BAO/TrackableURLOpen.php
But I can't find any difference in how times are saved.
CRM/Mailing/BAO/Job.php – LINE 322
           $saveJob->start_date = date('YmdHis');
           $saveJob->status     = 'Running';
           $saveJob->save();
CRM/Mailing/Event/BAO/TrackableURLOpen.php – LINE 101
        $open->time_stamp = date('YmdHis');
        $open->save();
Any ideas on where the bug is? Is there some timezone manipulation in Civi that I'm not aware of that might be affecting Jobs differently than Tracked Opens / Clicks?