BUG in localtime(time)? 
Author Message
 BUG in localtime(time)?

The $year returned by localtime(time) seems to be number of years
past 1970 and not past 1900 as is documented in the man pages.
Woa! A B-Bug

---

Important letters which contain no errors will develop errors
in the mail. Corresponding errors will show up in the duplicate
while the Boss is reading it.



Fri, 30 Jul 2004 02:38:03 GMT  
 BUG in localtime(time)?

Quote:
>> On Mon, 11 Feb 2002 02:38:03 +0100,

> The $year returned by localtime(time) seems to be number
> of years past 1970 and not past 1900 as is documented in
> the man pages.  Woa! A B-Bug

The documentation is correct.  perldoc is correct, so is
the man page for localtime(3).  I think you are conflating
2 different time values.

--
Oh!  I've said too much.  Smithers, use the amnesia ray.



Fri, 30 Jul 2004 02:49:12 GMT  
 BUG in localtime(time)?


Quote:

> The $year returned by localtime(time) seems to be number of years
> past 1970 and not past 1900 as is documented in the man pages.
> Woa! A B-Bug

> ---

> Important letters which contain no errors will develop errors
> in the mail. Corresponding errors will show up in the duplicate
> while the Boss is reading it.

Not for me.  Are you sure your not querying the system call localtime?
Most, if not all, *nix use 1970 as the epoch for the OS time.

Mark
______________________________________________________________________________
Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net



Fri, 30 Jul 2004 02:49:10 GMT  
 BUG in localtime(time)?

Quote:

> > of years past 1970 and not past 1900 as is documented in
> > the man pages.  Woa! A B-Bug

> The documentation is correct.  perldoc is correct, so is
> the man page for localtime(3).  I think you are conflating
> 2 different time values.

You are right. There must be a strange coincidence in an
incorrected collected byte and the final result. Rather
extrange, I have seeing various scripts running well and
a new one having this conduct. Thanks for your help.

Quote:

> --
> Oh!  I've said too much.  Smithers, use the amnesia ray.

Me too!

---

Peace, n.: In international affairs, a period of cheating
between two periods of fighting.
                 -- Ambrose Bierce, "The Devil's Dictionary"



Fri, 30 Jul 2004 14:13:06 GMT  
 BUG in localtime(time)?

Quote:
> > The $year returned by localtime(time) seems to be number of years
> > past 1970 and not past 1900 as is documented in the man pages.
> > Woa! A B-Bug

> Not for me.  Are you sure your not querying the system call localtime?
> Most, if not all, *nix use 1970 as the epoch for the OS time.

It seems possible, since it's an extrange coincidence.
Anyway, the bug was corrected reading the apropiate byte
from an maybe excessive truncated string.
Like this
        $s = substr($_,0,6);
        for (0..6) { $byte[$_] = ord(substr($s,$_,1)); }
The bug dissapered using
        $s = substr($_,0,7);  <-
What the hell I was reading in byte[6]? It's a mistery.
Best regards,

---

Peace, n.: In international affairs, a period of cheating
between two periods of fighting.
                 -- Ambrose Bierce, "The Devil's Dictionary"



Fri, 30 Jul 2004 14:33:22 GMT  
 BUG in localtime(time)?
On Mon, 11 Feb 2002 14:33:22 +0100,

Quote:
>It seems possible, since it's an extrange coincidence.
>Anyway, the bug was corrected reading the apropiate byte
>from an maybe excessive truncated string.
>Like this
>    $s = substr($_,0,6);
>    for (0..6) { $byte[$_] = ord(substr($s,$_,1)); }
>The bug dissapered using
>    $s = substr($_,0,7);  <-
>What the hell I was reading in byte[6]? It's a mistery.
>Best regards,

You weren't using the localtime function in array context and
taking element 5 to get the year?

$year = 1900 + (localtime)[5];
print "year=$year\n";

Villy



Fri, 30 Jul 2004 14:42:11 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. PERLFUNC: localtime - convert UNIX time into record or string using local time

2. PERLFUNC: localtime - convert UNIX time into record or string using local time

3. QUICK question on gmtime(time) and localtime(time)

4. print localtime(time)

5. Time::Local localtime();

6. Help with Time::localtime

7. localtime giving wrong time

8. Time::localtime problem

9. use Time::localtime; inside require packages

10. Y2K. localtime(time)

11. A month behind using localtime(time) ?

12. Help with Time::localtime

 

 
Powered by phpBB® Forum Software