eAuction
  Not just another Perl script
Google
Welcome, Guest. Please Login or Register


If you use eAuction a lot and like it or if you make money from eAuction or from eAuction-related activities ...
then the project asks you for a donation in favor of the further development.



The forums are protected by
AccessControl
(written by Dieter Werner)
Click here if you want to check your IP against the most important RBLs of the net.
Click here in order to visite the AccessControl forums.


<< Visit the international e Auction Marketplace >>
Buy and sell PC and Consumer Electronic components






  HomeHelpSearchLoginRegister
 



Pages: 1 2 3 4
sub get_the_time (Read 932 times)
Dieter Werner
Administrator
*****
Offline

Dipl. Paranoiac ®

Posts: 1162
Germany
Gender: male
sub get_the_time
11/16/03 at 14:40:21
 
There is a time problem with some servers; therefore I changed the code of this function.
Replace your existing subroutine with this:

sub get_the_time {
   my @temp = @_;
   my $day_base;

   my $offset = 24 * 3600;  
   my $real_day = int(((localtime(time()))[3]));
   my $time_base = ((int((time() / 86400)))) * 86400;
   my $hour_base = int(((localtime($time_base))[2]));
   my $tdl = $config{'time_delay'} || 0;
   my @time = map { $_ = int($_); $_ } @temp;
   my ($d, $h, $m, $s) = @time;
       
   $time_base += (((24 - $hour_base)) * 3600);
   $day_base = int(((localtime($time_base))[3]));
       
         if ($real_day > $day_base) { $time_base += $offset }
         elsif ($real_day < $day_base) { $time_base -= $offset }
       
   $h > 23 && ($h = 23);
   $m > 59 && ($m = 59);
   $s > 59 && ($s = 59);
   
   $d *= 86400 || 0;
   $h *= 3600;
   $m *= 60;
   
   $tdl != 0 && ($tdl = int($tdl) *3600);
   
   $time_base + $d + $h + $m + $s - $tdl;
}

The current eAuction161.zip is allready containg this subroutine.
Back to top
 
« Last Edit: 12/04/03 at 17:19:46 by Dieter Werner »  

Multimedia file viewing and clickable links are available for registered members only!!  You need to Login or Register!!


Greetings from Germany
Dieter Werner




Advertising
View Profile | WWW   IP Logged
Raymes
eAuction User
**
Offline

I love Perl

Posts: 5

Re: sub get_the_time
Reply #1 - 01/28/04 at 03:29:57
 
Good day,

I'm using this subroutine in the 161 zip already, but it still gives alot of problems.. i think it could be because my time offset is at -16...

I've traced the error and found that at some times of the day, the date is correct and on others, it's one day after..

I've tried some quick plugs like adding a -1 to:
my $real_day = int(((localtime(time()))[3])-1);

But i guess i don't really understand the bugs here... Please help?
Back to top
 
 


Advertising
View Profile   IP Logged
Dieter Werner
Administrator
*****
Offline

Dipl. Paranoiac ®

Posts: 1162
Germany
Gender: male
Re: sub get_the_time
Reply #2 - 01/28/04 at 12:35:51
 
Hello Rymes,

this should resolve your problems ...

#-#############################################
# Sub: Get Start-Time and Close-Time
# Written by: Dieter Werner
#-#############################################
sub get_the_time {
   my @temp = @_;
   my ($day_base, $ret_val);

   my $offset            = 24 * 3600;  
   my $real_day            = int(((localtime(time()))[3]));
   my $time_base      = ((int((time() / 86400)))) * 86400;
   my $hour_base      = int(((localtime($time_base))[2]));
   my $tdl                  = $config{'time_delay'} || 0;
   my @time            = map { $_ = int($_); $_ } @temp;
   my ($d, $h, $m, $s)      = @time;
       
   $tdl >= 0
               ?   ($time_base += (((24 - $hour_base)) * 3600))
               :   ($time_base -= (((24 + $hour_base)) * 3600));
   
   $day_base = int(((localtime($time_base))[3]));    

   $real_day > $day_base
               ?   ($time_base += $offset)
               :   ($time_base -= $offset);
       
   $h > 23 && ($h = 23);
   $m > 59 && ($m = 59);
   $s > 59 && ($s = 59);
   
   $d *= 86400 || 0;
   $h *= 3600;
   $m *= 60;
   
   $tdl != 0 && ($tdl = int($tdl) *3600);
     
   $time_base + $d + $h + $m + $s - $tdl;
}
Back to top
 
 

Multimedia file viewing and clickable links are available for registered members only!!  You need to Login or Register!!


Greetings from Germany
Dieter Werner




Advertising
View Profile | WWW   IP Logged
Pages: 1 2 3 4


If you like eAuction, please Rate it.
If you don't like eAuction, please Rate it too.


1 is being poor and 10 is being excellent


EveryScript

ip-location


AccessControl - Members Only