Server time vs. site time when setting auction expir

gjerdery - May 7, 2009 - 18:42
Project:Ubercart Auction
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Our site is configured for local time (America/Chicago), and caters to a largely local audience, however we are hosted by a server in California. When setting the expiration time, it appears we are asked to enter a time relative to the server time. Is there a way to have that be reflected against the local timezone?

#1

rsm08 - May 7, 2009 - 20:00

Yes, the expiration time is saved as a Unix timestamp which is timezone independant.

To calibrate the time users see and enter in the expiry field to their local time, you just have to tell the functions that convert the database expiry time to human readable time to use the user's local time.

The date is retrieved from the database in uc_auction_form_alter() and in the theme functions for theming the auction parts of the product listings.

#2

Garrett Albright - May 8, 2009 - 00:01

gjerdery, did you go to Administer > Site configuration > Date and time and adjust the time zone to Chicago's time zone? That should cause Ubercart Auction to do all its date calculations with regards to Chicago's time zone. If it doesn't work, either the server is misconfigured or it's a bug…

If you have SSH access to the server, try running date -u on the server and make sure it roughly matches this. If not, the server's clock is wrong. If so, then please come back here and post again.

#3

gjerdery - May 13, 2009 - 21:29

Yes, I did set the site time zone to Chicago in the Date and Time admin page. I don't have ssh access to this server, unfortunately.

We noticed a similar problem following the move to DST in March and I found some advice to add
date_default_timezone_set('America/Chicago');
somewhere... unfortunately that is all I recorded for documentation - I forgot to record what module to add it to! I'm a little embarrassed to admit that! And now, I can't find reference to that advice again... It did fix the issue the first time.

#4

Garrett Albright - May 13, 2009 - 22:15

Hmm. Try adding that line to your site's settings.php file. Anywhere in that file should be fine. I would imagine - or maybe just fruitlessly hope - that it wouldn't do anything different than what Drupal's standard time zone adjustment features do, however…

#5

gjerdery - May 14, 2009 - 15:55

Adding the above code to the settings.php file does fix my problem. The example time listed under the Expiration Date & Time field now displays the current time, and I'm able to enter an end time that displays relative to the current time, rather than to the server time.

Thanks for pointing me in the right direction... seems like this could be an issue related to the server config, or perhaps the date api.

#6

Garrett Albright - May 14, 2009 - 18:00
Status:active» fixed

Schweet. If/when I get back to work on the UC Auction module, I'll add a note in the docs so other people who may be having trouble can give that a try.

#7

System Message - May 28, 2009 - 18:10
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.