Mailing List Archive

localtime inconsistency
Help please. I'm displaying the current date in embperl.
Why is it that sometimes I get a 1day lag date (even when clicking
refresh)?

excerpt from new.epl:
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Cache-Control" content="no-cache">
</head>
<body>
[-
($curmday, $curmon, $curyear) = (localtime(time()))[3, 4, 5];
$curyear += 1900; $curmon += 1;
$fdat{date} = "$curmon\-$curmday\-$curyear";
-]


Thanks.
Sherwin
Re: localtime inconsistency [ In reply to ]
> Help please. I'm displaying the current date in embperl.
> Why is it that sometimes I get a 1day lag date (even when clicking
> refresh)?
>
> excerpt from new.epl:
> <meta http-equiv="Pragma" content="no-cache">
> <meta http-equiv="Expires" content="0">
> <meta http-equiv="Cache-Control" content="no-cache">
> </head>
> <body>
> [-
> ($curmday, $curmon, $curyear) = (localtime(time()))[3, 4, 5];
> $curyear += 1900; $curmon += 1;
> $fdat{date} = "$curmon\-$curmday\-$curyear";
> -]
>
>
This should normaly not happen.

What is happening if you do a

[+ scalar (localtime) +]

? Does this show the correct date/time?

Gerald