Samba 3.0 Alpha 21 - TZ environment variable.

Clive.Elsum at Clive.Elsum at
Sun Jan 12 07:47:01 GMT 2003

Maybe the suggestion I made some time ago which worked for Solaris may work
for HP as well, if the Tridge replacement doesn't.
The timegm replacement within replace.c (see earlier e-mails).

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

  tl = mktime (t);
  if (tl == -1)
      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)
      tb = mktime (tg);
      if (tb == -1)
        return -1; /* can't deal with output from gmtime */
      tb += 3600;
  return (tl - (tb - tl));

Clive.Elsum at

-----Original Message-----
From: P Ranjit Kumar [mailto:ranjit at]
Sent: Saturday, 11 January 2003 9:45 AM
To: Andrew Bartlett; jra at
Cc: samba-technical at
Subject: RE: Samba 3.0 Alpha 21 - TZ environment variable.

That will be a cool solution. I will take a look at it.

- Ranjit

-----Original Message-----
From: Andrew Bartlett [mailto:abartlet at]
Sent: Friday, January 10, 2003 2:34 PM
To: jra at
Cc: P Ranjit Kumar; samba-technical at
Subject: Re: Samba 3.0 Alpha 21 - TZ environment variable.

On Sat, 2003-01-11 at 09:14, jra at wrote:
> On Fri, Jan 10, 2003 at 02:04:12PM -0800, P Ranjit Kumar wrote:
> > Hi
> >
> > Samba 3.0 Alpha21 tries to emulate the timegm() call. When it does that,
> > sets the TZ="" before it invokes the mktime() call. However, on HP-UX,
> > setting TZ="" makes the timezone to be EST but what we want is GMT for
> > time_t computation. This results in Samba failing to a join a domain.
> Adding platform specific code (like #ifdef HPUX) isn't something we
> want to move towards. Does HPUX not have timegm ? If not, can you
> work out a feature test patch that fixes it for HPUX rather than
> a platform specific one ?

Tridge's timegm() replacement doesn't use TZ any more, and has been
merged into Samba 3.0, for the next alpha.

Andrew Bartlett

Andrew Bartlett                                 abartlet at
Manager, Authentication Subsystems, Samba Team  abartlet at
Student Network Administrator, Hawker College   abartlet at

More information about the samba-technical mailing list