Author Topic: Daylight Saving Time problem  (Read 400 times)

Offline Sunchaser

  • Game Owner
  • Level 23
  • *
  • Posts: 296
  • Reputation: +3/-0
  • Game Owner
    • View Profile
    • Medieval Europe
Daylight Saving Time problem
« on: March 08, 2009, 05:11:46 AM »
hello, in our game players do some actions, and these action have cooldowns.

This night i think US or CANADA (where the server is located) switched to daylight saving time, resulting in all the cooldowns increased by 1 hour;

For example, i have the following code:

Code: [Select]

$action_start_time = time();
$action_end_time = $action_start_time + 3600;


Normally an action started at 01:00, will finish at 02:00, but today it finshed at 03:00

Anyone knows how to fix this problem?

Thanks

Offline Teckniel

  • Level 5
  • *
  • Posts: 18
  • Reputation: +0/-0
    • View Profile
Re: Daylight Saving Time problem
« Reply #1 on: March 08, 2009, 12:59:54 PM »
Here you go :)
Hope it helps

note that 23:55 + 1 hour = 24:55 and not 00:55

Regards me.

Code: [Select]
<?php
  $aTemp  
explode(':',date('G:i'));
  
$starttime implode(':',($aTemp));
  if (
$aTemp[0] == '24') { $aTemp[0] = "00"; }
  
$aTemp[0]++;
  
$endTime =   implode(':',($aTemp)); 
  echo  
"Start Time" .$starttime."<br>";
  echo 
"End Time: ".$endTime."<br>";  
?>




 


SimplePortal 2.3.3 © 2008-2010, SimplePortal