Zen Cart Logo
Forums / Bug Reports / Time Change and Sales Report??

Time Change and Sales Report??

Locked

Views: 5,308

Results 1 to 14 of 14
This thread is locked. New replies are disabled.
9 Mar 2008, 6:58 AM
#1
jrafuse avatar

jrafuse

New Zenner

Join Date:
Apr 2004
Posts:
31
Plugin Contributions:
0

Time Change and Sales Report??

Tonight is when the time advances 1 hour for most people in North America, and I just ran into something which I think is related to this change.

I am running Zen Cart 1.3.0.1, with Database Patch Level: 1.3.0.1

and Sales Report 2.0

I just switched my screen from running a Daily Report for March 8, 2008 to run a Daily Report for March 9, 2008 ... and the report is now displaying March 9, and March 10 in the single day report. Nothing about the report was changed in any way except for the date, and I use this screen to do a running total all day, every day. I don't recall whether this happened in prior years, as this is the first day that I have actually been sitting here at or around midnight Server Time (my server is in Dallas, central time).

I hope this is enough info :smile:

John

9 Mar 2008, 7:09 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Time Change and Sales Report??

  1. Are you talking about a report built-in to Zen Cart? or an addon?

  2. Isn't this the same as what happens when the clock hits midnight each day, and the "date" "changes"?

9 Mar 2008, 11:19 AM
#3
jrafuse avatar

jrafuse

New Zenner

Join Date:
Apr 2004
Posts:
31
Plugin Contributions:
0

Re: Time Change and Sales Report??

DrByte:

  1. Are you talking about a report built-in to Zen Cart? or an addon?

  2. Isn't this the same as what happens when the clock hits midnight each day, and the "date" "changes"?

1 - It is Blindsides Sales Report 2.0

2 - It is NOT the same. As I've stated before I have run this report as a daily running total, so that I know at a moments; notice how things are going. This is the first time I've ever seen this happen, and as of right now (6:12am Central time) it is still displaying both March 9 and March 10. It is as if it is confused as to which day it is. Nothing else on the server is showing the slightest blip other than this one thing, and I'm thinking that it might have something to do with the time change today. If it was just a date change, I think it would be showing yesterday and today ... not today and tomorrow.

I don't know if it is something in BlindSide's Sales Report 2.0 or in ZenCart, but I figured this was the best place to mention this. I think it happened like this last year as well, but I'm not certain as I wasn't awake when the clock rolled over like I was this time, so when I noticed it later in the day, I think I ended up passing it off as a glitch, because the next day the problem disappeared!

BTW, when I stated earlier that I wasn't around when it rolled over before ... I only meant on the day that the clocks changed. I have been at my computer most nights when the server rolls through midnight, and have never seen this happen on any normal night, but it did happen tonight. It's as if Zencart, or the Sales Report thinks it is one day while the other thinks it is the other one, so they end up displaying both?????

John

9 Mar 2008, 1:06 PM
#4
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: Time Change and Sales Report??

jrafuse:

Tonight is when the time advances 1 hour for most people in North America, and I just ran into something which I think is related to this change.

I am running Zen Cart 1.3.0.1, with Database Patch Level: 1.3.0.1

and Sales Report 2.0

I just switched my screen from running a Daily Report for March 8, 2008 to run a Daily Report for March 9, 2008 ... and the report is now displaying March 9, and March 10 in the single day report. Nothing about the report was changed in any way except for the date, and I use this screen to do a running total all day, every day. I don't recall whether this happened in prior years, as this is the first day that I have actually been sitting here at or around midnight Server Time (my server is in Dallas, central time).

I hope this is enough info :smile:

John

Check Admin -> Tools -> server info
See if Server time and database time are the same??

11 Mar 2008, 7:42 PM
#5
jrafuse avatar

jrafuse

New Zenner

Join Date:
Apr 2004
Posts:
31
Plugin Contributions:
0

Re: Time Change and Sales Report??

Nope ... Server and Database time are exactly the same :(

On this same note ... I also run a Month-to-Date report, which today is set for March 01,2008 through March 10, 2008. The report shows all ten days, but the day count at the bottom show "9" instead of "10" .

I just checked my records ... and the same thing happened LAST March ... The month-to-date report was set for all 31 days, but the count at the bottom shows only 30 days. All with version 1.3.0.1 of Zencart. Different Server platforms from last year to now. Change was made in November 2007. The reports for 2004, 2005, and 2006 all show things correctly for March, but they show the 1 day difference for April (should be showing 30 days, but total says 29 days).

The difference here is that Daylight Savings Time changed in the US in 2007 from April to March ... from my side of things, this has to be significant, as the count inaccuracy seems to be entirely related to spring-time change to DST. Prior to 2007 the in-accurate count happens in April coinciding with the time change in April. Now, since March 2007 , that inaccuracy occurs in March ... again coinciding with DST.

As I stated earlier ... maybe it is a problem with Sales Report 2.0 and Zencart arguing about the change to DST, or maybe it is something else, but I think it is significant that it only occurs around that event.

Maybe someone else has a better idea???

John

2 Apr 2008, 1:08 AM
#6
blindside avatar

blindside

Totally Zenned

Join Date:
Sep 2004
Posts:
1,237
Plugin Contributions:
1

Re: Time Change and Sales Report??

My SR doesn't do anything at all with DST, so I don't think SR would be responsible directly.

You've got examples from March, what about Jan and Feb in 2007 and 2008. Same results?

Any recent server switches or major upgrades? If so, you might want to compare your reports with the known server change.

4 Apr 2008, 4:00 PM
#7
jrafuse avatar

jrafuse

New Zenner

Join Date:
Apr 2004
Posts:
31
Plugin Contributions:
0

Re: Time Change and Sales Report??

BlindSide:

My SR doesn't do anything at all with DST, so I don't think SR would be responsible directly.

You've got examples from March, what about Jan and Feb in 2007 and 2008. Same results?

Any recent server switches or major upgrades? If so, you might want to compare your reports with the known server change.

As stated previously ... it ONLY happens during the month that the time changes forward. January, and February as well as April last year show accurately the number of days, etc. Only March shows the problem. Same thing this year, now that we are in April. April is showing the right number of days, same as Jan, and Feb ... but March is still off by one day less. Prior to the change from April to March in the U.S., this glitch was happening in April, now it is March. There definitely seems to be a correlation here. I have changed Servers twice during this period where this happens, as well as going from ZenCart 1.2.7 to 1.3.0.1 to 1.3.8a. The only thing which is consistent across all of these changes is Sales Report 2. That is why I mentioned it.

I hope this helps ...

John

5 Apr 2008, 4:53 PM
#8
blindside avatar

blindside

Totally Zenned

Join Date:
Sep 2004
Posts:
1,237
Plugin Contributions:
1

Re: Time Change and Sales Report??

I agree that that is a very strange behavior, but again all of the time functionality in the report comes from PHP and MySQL, which in turn take their orders from the server.

You can see it for yourself from lines 60 to 71 in admin/includes/classes/sales_report.php ...

      // all our calculations are done using a "raw" timestamp format, which are
      // pulled from entered date strings using the substr function (similar to zen_date_raw)
      $this->sd_raw = mktime(0, 0, 0, substr($sd, 0, 2), substr($sd, 3, 2), substr($sd, 6, 4) );
      $this->ed_raw = mktime(0, 0, 0, substr($ed, 0, 2), substr($ed, 3, 2), substr($ed, 6, 4) );

      // run a few checks on the dates
      // avoid dates before the first order
      $first = $db->Execute("select UNIX_TIMESTAMP(min(date_purchased)) as date FROM " . TABLE_ORDERS);
      $first_order = $first->fields['date'];
      $this->global_sd = mktime(0, 0, 0, date("m", $first_order), date("d", $first_order), date("Y", $first_order));
      if ($this->sd_raw < $this->global_sd) $this->sd_raw = $this->global_sd;
      if ($this->ed_raw < $this->global_sd) $this->ed_raw = $this->global_sd;

The code certainly isn't doing anything different within the month of March, and I've never heard a report of an error like this. Based on this and my experience as a server admin, I think you really need to look at your server configuration. Start with the kernel's time keeping and DST settings, then look at Apache, MySQL, and PHP, in that order. A server swap would identify the source immediately, but that's obviously a little more involved.

I wish I could offer a better solution, but I will keep an eye out for similar issues.

6 Apr 2008, 7:08 AM
#9
jrafuse avatar

jrafuse

New Zenner

Join Date:
Apr 2004
Posts:
31
Plugin Contributions:
0

Re: Time Change and Sales Report??

The reason I even brought it up this year is that I just DID a Server swap in December. Went from Redhat Enterprise 3 to 5, from PHP 4 to 5, Zencart 1.2.7 to Zencart 1.3.8a, and everything else is brand new, except for some templates ... yet the same thing. So I thought I'd ask ... it is not like it is screwing up the sales numbers or anything ... just a bit of an annoyance more than anything else, but I have no explanation for it.

John

14 Apr 2008, 1:16 PM
#10
blindside avatar

blindside

Totally Zenned

Join Date:
Sep 2004
Posts:
1,237
Plugin Contributions:
1

Re: Time Change and Sales Report??

You were seeing the same behavior before the server change?

...alright, I got nothing...

8 Mar 2009, 10:40 AM
#11
jrafuse avatar

jrafuse

New Zenner

Join Date:
Apr 2004
Posts:
31
Plugin Contributions:
0

Re: Time Change and Sales Report??

OK ... for Dr. Byte, and Blindside.

Here we go again :) ... It is now 3:29am Arizona time, with my servers both in Texas in Central time ... ALL other software (vBulletin, PhotoPost, cPanel/WHM, etc) are all showing the correct server time and date of March 8, 2009 5:29am as is ZenCart ... however, as reported i the opening of this thread ... the Sales Report for today (March 8, 2009) is showing the running totals for today, plau a zero total entry below it for tomorrow (March 9, 2009).

I don't know what else I can tell you about this "glitch", except to re-iterate that this happened on three different servers with three different ISPs and server configurations, as well as different versions of ZenCart. First noticed with Zencart 1.27, then 1.30.1, and now 1.38a ...

Maybe all the above will help track it down?

Like I said ... it is just a minor annoyance, once you realize that the numbers are still correct except for the number of days that month.

Hope this helps,

John

BlindSide:

You were seeing the same behavior before the server change?

...alright, I got nothing...

8 Mar 2009, 10:02 PM
#12
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: Time Change and Sales Report??

As it only happens when the the DST changes.
I still say there must be a difference in the PHP and MySql times

Check Admin -> Tools -> server info
See if Server PHP time and mySql are the same as your local time zone??

As I am in Oz and my server is in the US
I keep my PHP server time correct with the statement
putenv ('TZ=Australia/Melbourne');

My MySql server time needs to changed 4 times a year as my timezone and the US server time zones goes in an out of DST

As I have a difference of 15 to 17 hours between these time zones. I have to "fix" the MySql difference with the Time Zone Offset mod.

I suspect that because your time zones (local and server) are only 2 hours apart you don't bother applying this fix and that is causing your problem when the DST changes

I also use the Sales Report mod and it would not work correctly for me if I didn't fix the difference between PHP and MySql time.

6 Apr 2009, 5:43 AM
#13
southpacific avatar

southpacific

New Zenner

Join Date:
Feb 2009
Location:
Sydney, Australia
Posts:
44
Plugin Contributions:
0

Re: Time Change and Sales Report??

I also have the same issue, my server is in the USA (-7 GMT) and I am in Australia (+10 GMT).

Does anyone know a fix which will show my reports in my time zone? Or a fix which adds 17 hours to the reporting times?

Thanks