RE: Samba 3.0 alpha 20 problem with timegm->mktime() on HP-UX

2002-11-28 Thread Andrew Bartlett
On Thu, 2002-11-28 at 11:17, [EMAIL PROTECTED] wrote:
> I have already included a fix for this which you could try. See previous
> e-mail to Andrew and samba-technical attached. Hopefully this will be
> adopted as a fix at some stage.

I got tridge to have a look at that patch, and he did some work on a
replacement.  (He didn't see exactly what it was trying to do).  What
was more interesting was seeing his IRC comments while coding a
replacement...  It seems POSIX is quite brain-dead in this area -
ignoring daylight savings, normalising the time struct, and generally
being 'helpful' :-).  (Of course, GMT is never on daylight savings).

Andrew Bartlett

-- 
Andrew Bartlett [EMAIL PROTECTED]
Manager, Authentication Subsystems, Samba Team  [EMAIL PROTECTED]
Student Network Administrator, Hawker College   [EMAIL PROTECTED]
http://samba.org http://build.samba.org http://hawkerc.net



signature.asc
Description: This is a digitally signed message part


Re: Samba 3.0 alpha 20 problem with timegm->mktime() on HP-UX

2002-11-27 Thread jra
On Wed, Nov 27, 2002 at 04:06:58PM -0800, P Ranjit Kumar wrote:
> Hi
> 
> I had a problem with net ads join on HP-UX. I used mktime() instead of the
> timegm() that was used in Samba 3.0 alpha 20.
> 
> net ads join gives error saying that the times are out of sync (Windows 2000
> DC and Samba HP Unix Box)
> 
> But they are in perfectly in sync. mktime() interprets the time as local
> time (PST8PDT). You need to set the TZ environment variable to GMT to solve
> the problem and get it working.

DOH ! Ignore my previous post (gmtime != timegm :-).

Sorry !

Jeremy.



Re: Samba 3.0 alpha 20 problem with timegm->mktime() on HP-UX

2002-11-27 Thread jra
On Wed, Nov 27, 2002 at 04:06:58PM -0800, P Ranjit Kumar wrote:
> Hi
> 
> I had a problem with net ads join on HP-UX. I used mktime() instead of the
> timegm() that was used in Samba 3.0 alpha 20.
> 
> net ads join gives error saying that the times are out of sync (Windows 2000
> DC and Samba HP Unix Box)
> 
> But they are in perfectly in sync. mktime() interprets the time as local
> time (PST8PDT). You need to set the TZ environment variable to GMT to solve
> the problem and get it working.

Yes, this is by specification (that mktime uses local time).

Is there no gmtime on HPUX ? It's in the single unix spec and
in the ISO C spec.

Jeremy



RE: Samba 3.0 alpha 20 problem with timegm->mktime() on HP-UX

2002-11-27 Thread Clive . Elsum
I have already included a fix for this which you could try. See previous
e-mail to Andrew and samba-technical attached. Hopefully this will be
adopted as a fix at some stage.

Andrew,

Another suggestion which appears to work without a kludge is a very minor
mod to the code originally contributed by Roger Beeman <[EMAIL PROTECTED]>,
with the help of Mark Baushke <[EMAIL PROTECTED]> and the rest of the Gurus at
CISCO. Further improved by Roger with assistance from Edward J. Sabol based
on input by Jamie Zawinski. 
Setting this as a timegm replacement within lib/replace.c overcomes the need
to reset TIMEZONE.


 time_t timegm(struct tm *t)
{
  time_t tl, tb;
  struct tm *tg;

  tl = mktime (t);
  if (tl == -1)
{
  t->tm_hour--;
  tl = mktime (t);
  if (tl == -1)
return -1; /* can't deal with output from strptime */
  tl += 3600;
}
  tg = gmtime (&tl);
  tg->tm_isdst = 0;
  tb = mktime (tg);
  if (tb == -1)
{
  tg->tm_hour--;
  tb = mktime (tg);
  if (tb == -1)
return -1; /* can't deal with output from gmtime */
  tb += 3600;
}
  return (tl - (tb - tl));
}

-
Clive Elsum BAppSc, RHCE
Systems Engineer - Information Technology Group
CSIRO Atmospheric Research
PMB 1, Aspendale, Victoria, Australia  3195
Phone : (+61 3) 9239 4509
Fax:(+61 3) 9239 
E-mail [EMAIL PROTECTED]
-



-Original Message-
From: P Ranjit Kumar [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, 28 November 2002 11:07 AM
To: [EMAIL PROTECTED]
Subject: Samba 3.0 alpha 20 problem with timegm->mktime() on HP-UX

Hi

I had a problem with net ads join on HP-UX. I used mktime() instead of the
timegm() that was used in Samba 3.0 alpha 20.

net ads join gives error saying that the times are out of sync (Windows 2000
DC and Samba HP Unix Box)

But they are in perfectly in sync. mktime() interprets the time as local
time (PST8PDT). You need to set the TZ environment variable to GMT to solve
the problem and get it working.

If I come up with a programatic solution to this issue, I will leave it on
the mailing list.

- Ranjit
@ HP CIFS Team.



Samba 3.0 alpha 20 problem with timegm->mktime() on HP-UX

2002-11-27 Thread P Ranjit Kumar
Hi

I had a problem with net ads join on HP-UX. I used mktime() instead of the
timegm() that was used in Samba 3.0 alpha 20.

net ads join gives error saying that the times are out of sync (Windows 2000
DC and Samba HP Unix Box)

But they are in perfectly in sync. mktime() interprets the time as local
time (PST8PDT). You need to set the TZ environment variable to GMT to solve
the problem and get it working.

If I come up with a programatic solution to this issue, I will leave it on
the mailing list.

- Ranjit
@ HP CIFS Team.