Perl localtime strange behavior

T

Teknopath

Any help would be appreciated...

I do the following in my code:

$inputQueueCounts{$queueN}{'Time'} = localtime;
if ($bufferLength >= $inputQueueCounts{$queueN}{'Max'})
{
$inputQueueCounts{$queueN}{'Max'} = $bufferLength;
$inputQueueCounts{$queueN}{'MaxTime'} =
$inputQueueCounts{$queueN}{'Time'};
}


I would expect $inputQueueCounts{$queueN}{'Time'} and
$inputQueueCounts{$queueN}{'MaxTime'} to have the same value, but in
actuality, $inputQueueCounts{$queueN}{'MaxTime'} is showing 10 seconds
earlier. How could this be happening?


:meb:
 
T

Tony Curtis

On 5 Nov 2003 07:37:36 -0800,
Any help would be appreciated... I do the following in my
code:
$inputQueueCounts{$queueN}{'Time'} = localtime; if
($bufferLength >= $inputQueueCounts{$queueN}{'Max'}) {
$inputQueueCounts{$queueN}{'Max'} = $bufferLength;
$inputQueueCounts{$queueN}{'MaxTime'} =
$inputQueueCounts{$queueN}{'Time'};
}
I would expect $inputQueueCounts{$queueN}{'Time'} and
$inputQueueCounts{$queueN}{'MaxTime'} to have the same
value, but in actuality,
$inputQueueCounts{$queueN}{'MaxTime'} is showing 10 seconds
earlier. How could this be happening?

With the code you show, suitable setup values for the
variables in question to trigger the "if", and caeteris
paribus, both of them (of course) have the same value.

This presumably isn't the whole of your program. I suspect
you have another assignment occurring somewhere, or the "if"
condition is false.

hth
t
 
G

Gunnar Hjalmarsson

Teknopath said:
$inputQueueCounts{$queueN}{'Time'} = localtime;
if ($bufferLength >= $inputQueueCounts{$queueN}{'Max'})
{
$inputQueueCounts{$queueN}{'Max'} = $bufferLength;
$inputQueueCounts{$queueN}{'MaxTime'} =
$inputQueueCounts{$queueN}{'Time'};
}

I would expect $inputQueueCounts{$queueN}{'Time'} and
$inputQueueCounts{$queueN}{'MaxTime'} to have the same value, but
in actuality, $inputQueueCounts{$queueN}{'MaxTime'} is showing 10
seconds earlier. How could this be happening?

How on earth do you think that anybody here would be able to tell
out from the above info?
 
C

Chris Mattern

Teknopath said:
Any help would be appreciated...

I do the following in my code:

$inputQueueCounts{$queueN}{'Time'} = localtime;
if ($bufferLength >= $inputQueueCounts{$queueN}{'Max'})
{
$inputQueueCounts{$queueN}{'Max'} = $bufferLength;
$inputQueueCounts{$queueN}{'MaxTime'} =
$inputQueueCounts{$queueN}{'Time'};
}


I would expect $inputQueueCounts{$queueN}{'Time'} and
$inputQueueCounts{$queueN}{'MaxTime'} to have the same value, but in
actuality, $inputQueueCounts{$queueN}{'MaxTime'} is showing 10 seconds
earlier. How could this be happening?
It is happening because $bufferLength is less than
$inputQueueCounts{$queueN}{'Max'}.

Chris Mattern
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,296
Messages
2,571,535
Members
48,279
Latest member
RedaBruno6

Latest Threads

Top