[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] sprintf - 5.1 vs. 5.0.6



Friends,

I'm working on a project that involves using time stamps in log records. Until
installing the latest release of MacPerl (5.1.Or.2) this aspect of the system
worked fine. I was using MacPerl 5.0.6r1m. Then I installed 5.1 and things
started to break. Here is a distilled version of the code that doesn't seem to
work right:

#!perl

  require 'timelocal.pl';

  $basetime = &timegm(0,0,0,24,6,96);

  $x = &GetTimeStamp();

  print ("$x\n");

sub GetTimeStamp {
    local ($currenttime) = time();
    local ($stime) = $currenttime - $basetime;
    return sprintf("%08X", $stime);
}

__END__


This code will give me widely varying results between the two versions. Running
them both side by side 5.1 will give me this Hex number: AE9B87F8
5.0.6, run moments later, will give me this Hex number: 0080B64A

What am I missing here? I know there should be a slight difference amounting to
seconds of time not years! Can you tell me what's happening here? Thanks.

Dennis

:) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :)

Dennis Drescher                             SIL - IPub - NRSI
EMail: dennis_drescher@sil.org              7500 W. Camp Wisdom Road
Fax: (1) (972) 708-7388                     Dallas, TX 75236-5699 USA