Operating System - HP-UX
1753972 Members
8273 Online
108811 Solutions
New Discussion юеВ

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

 
Shinji Teragaito_1
Respected Contributor

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

Ooops, I forgot to mention one more thing.

I met the HiRes issue when building Perl 5.10.0 on 11.31.

Shinji
H.Merijn Brand (procura
Honored Contributor

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

Dennis, UTC0 would indeed be what most (all) users would use, but there is still an error in the code behind the scenes, and only 11.31 is barfing here.

Here is the test program that was used to expose it:
--8<--- tz.c
#include
#include
#include
#include

char *prt (struct tm *t)
{
char *timebuf = calloc (40, 1);
sprintf (timebuf, "%4d-%02d-%02d %2d:%02d:%02d",
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
return (timebuf);
} /* prt */

int main (int arc, char *argv[])
{
char *tz[6] = { "UTC", "GMT", "UTC0UTC", "GMT0GMT", "MET", "MET-1METDST" };
int i;
time_t lt, now = time (NULL);
struct tm *tp, *lp;

for (i = 0; i < 6; i++) {
(void)printf ("%-11s ", tz[i]);
setenv ("TZ", tz[i], 1);
tzset ();
tp = localtime (&now);
lt = mktime (tp);
lp = localtime (<);
(void)printf ("%ld %s : %ld %s (%6ld)\n",
now, prt (tp), lt, prt (lp), lt - now);
}
return (0);
} /* main */
-->8---

Compile and run that on all machines you have access to, and see the difference.

--8<--- 11.31 output
UTC 1234424250 2009-02-12 7:37:30 : 1234424250 2009-02-12 7:37:30 ( 0)
GMT 1234424250 2009-02-12 7:37:30 : 1234424250 2009-02-12 7:37:30 ( 0)
UTC0UTC 1234424250 2009-02-11 21:37:30 : 1234406250 2009-02-11 21:37:30 (-18000)
GMT0GMT 1234424250 2009-02-11 21:37:30 : 1234406250 2009-02-11 21:37:30 (-18000)
MET 1234424250 2009-02-12 7:37:30 : 1234424250 2009-02-12 7:37:30 ( 0)
MET-1METDST 1234424250 2009-02-12 8:37:30 : 1234424250 2009-02-12 8:37:30 ( 0)
-->8---

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Dennis Handly
Acclaimed Contributor

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

>H.Merijn: UTC0 would indeed be what most (all) users would use

None of your timezones are valid except for MET-1METDST. While UTC0UTC is syntacticly valid, it isn't semantically UTC:
$ TZ=UTC0UTC dst.pl
Sun Mar 08 01:59:59 UTC 2009 --> Sun Mar 08 03:00:00 UTC 2009
Sun Nov 01 01:59:59 UTC 2009 --> Sun Nov 01 01:00:00 UTC 2009

On my 11.31 system it works fine. Looking at the libc patch, I find PHCO_38048.

Ah, since you can only use setenv(3) on 11.31, I replaced it by putenv. Using setenv(3) causes it to fail. Not sure why only those two are bad?
H.Merijn Brand (procura
Honored Contributor

Re: Obscure "HiRes.so" problem when buidling Perl 5.8.8

I have the same patch installed.

Changing setenv () to putenv () does not change that behaviour on my system.

FYI I have done there excercises with someone from HP, and eventually he was able to reproduce.

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn