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
Re: sub get_the_time
Reply #9 - 02/10/04 at 15:02:15
 
Once again ...


#-#############################################
# Sub: Get Start-Time and Close-Time
# Written by: Dieter Werner
#-#############################################
sub get_the_time {
   my ($d, $h, $m, $s)      = @_;
   my $time_base      = ((int((time() / 86400)))) * 86400;    
   my $hour_trash      = ((localtime($time_base))[2]) * 3600;
   my $tdl                  = int($config{'time_delay'}) || 0;
   my $offset            = 0;
   
   my ($real_day, $base_day);
   local $_;    
   
   $time_base -=  $hour_trash;
   
   $real_day = (localtime)[7];
   $base_day = (localtime($time_base))[7];

   abs(($base_day - $real_day)) > 363
       ?   ($time_base += 86400)
       :   do {
               $base_day > $real_day && ($time_base -= 86400);
               $base_day < $real_day && ($time_base += 86400);
           };
   
   $h > 23      && ($h = 23);
   $m > 59      && ($m = 59);
   $s > 59      && ($s = 59);
   
   $d >= 1 ? ($d *= 86400) : ($d = 0);    
   $h *= 3600;
   $m *= 60;    
   
   abs($tdl) > 0 && do {
     $tdl *= 3600;
     
     $tdl > 0
         ?      do {
               ($h <= abs($tdl)) && ($offset = 86400);
               $time_base -= ($tdl - $offset);
           }
         :      do {
               ($h >= abs($tdl)) && ($offset = 86400);
               $time_base -= ($tdl + $offset);
           };
   };
   
   $time_base + $d + $h + $m + $s;
}

#-#############################################
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
jungle
eAuction User
**
Offline

I love Perl

Posts: 11

Re: sub get_the_time
Reply #10 - 02/11/04 at 15:04:34
 
I have tested this at different times of the day and night along with new and reposted items.  This script seems to work for me.  Tested for 24 hour period, will let you know if I find any problems.

Jim  Cheesy
Back to top
 
 


Advertising
View Profile   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