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)
Raymes
eAuction User
**
Offline

I love Perl

Posts: 5

Re: sub get_the_time
Reply #3 - 01/29/04 at 02:48:01
 
Thanks for your swift response, dieter, but somehow it still doesn't work.. The config is:
$config{'time_delay'}      = -16;

And the time when it fails to work is:
Current Time: 01.28.04 - 17:43:47  
Start-up: 01.29.04 - 17:43:34
or 5 minutes after last bid ...  
Deadline: 01.30.04 - 17:43:34
It was set to 0 offset for start-time

System time is around 01.29.04 - 09:43:47

Sorry for causing so much trouble to you, Dieter.. Thanks for your help!

Raymes

Back to top
 
« Last Edit: 01/29/04 at 05:28:14 by Raymes »  


Advertising
View Profile   IP Logged
Raymes
eAuction User
**
Offline

I love Perl

Posts: 5

Re: sub get_the_time
Reply #4 - 01/29/04 at 11:18:39
 
After looking through the code again and again, i changed it as such.. For my site it seems to work.  Please kindly advise if this is the correct method to do this.

Raymes



#-#############################################
# Sub: Get Start-Time and Close-Time
# Contributed 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 = time();
   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;


   $h > 23 && ($h = 23);
   $m > 59 && ($m = 59);
   $s > 59 && ($s = 59);

   $h -= (int(((localtime($time_base))[2]))+ $tdl + 24) if (int(((localtime($time_base))[2]))+ $tdl) < 0;
   $h -= (int(((localtime($time_base))[2]))+ $tdl) if (int(((localtime($time_base))[2]))+ $tdl) >= 0;
   $m -= int(((localtime($time_base))[1]));
   $s -= int(((localtime($time_base))[0]));

   $d *= 86400 || 0;
   $h *= 3600;
   $m *= 60;


    $time_base + $d + $h + $m + $s;
}
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 #5 - 02/03/04 at 12:42:31
 
I hope that this could be a more common solution of the problem.
Maybe someone can test the code under realtime-conditions.

Code:
#-#############################################
# 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;
   local $_;
  
   $h > 23	&& ($h = 23);
   $m > 59	&& ($m = 59);
   $s > 59	&& ($s = 59);
  
   $d > 0 ? ($d *= 86400) : ($d = 0);   
   $h *= 3600;
   $m *= 60;
  
   $time_base -=  $hour_trash;
  
   abs($tdl) > 0 && do {
	$tdl *= 3600;
	
	$tdl > 0
	    ?	do {
		    ($h <= abs($tdl)) && ($offset = 24 * 3600);
		    $time_base -= ($tdl - $offset);
		}
	    :	do {
		    ($h >= abs($tdl)) && ($offset = 24 * 3600);
		    $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
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