Cannot get net ads join to work under Solaris 8

David Collier-Brown -- Customer Engineering David.Collier-Brown at Sun.COM
Sat Nov 16 17:24:01 GMT 2002

Andrew Bartlett wrote:
> Actually, we got confused - the function that Samba replaced, which I
> suspected could be a problem is 'timegm'.
> Either way, there is a but in there somewhere, as it doesn't work for a
> non-GMT timezone.

	Ok, timegm is obsoleted in the standard, but it's
	still supported on lots of systems, specifically
	including anything with the Gnu libc, but
	not in Solaris or the Apple BSD.

	It's the inverse of gmtime, defined as
		time_t timegm(struct tm *tm);
	and is perfectly useful in some specific
	cases, where one wants to turn a struct tm
	back into a time_t.

	The usual inverse is
		time_t mktime(struct tm *timeptr);
	and it looks like there is enough functionality
	to implement timegm. Older man pages disagree, but
	standards folks don't get to frivolously remove things we 
	still need.  If they were to try, my Evil Twin, David 
	J. Brown,  would spank them (:-)) 
The POSIX man page says:
The original values of the tm_wday and tm_yday components of the
structure are ignored, and the original values of the other components 
are not restricted to the ranges described in the <time.h> entry. 

A positive or 0 value for tm_isdst causes mktime() to presume
that Daylight Savings Time, respectively, is or is not in effect for 
the specified time. A negative value for tm_isdst causes mktime() to 
attempt to determine whether Daylight Saving Time is in effect for 
the specified time. 

Local timezone information is set as though mktime() called tzset(). 
and the older man pages say:
The functions mktime() and timegm() convert the broken-down time in
structure pointed to by tm into a time value with the same encoding as
that of the values returned by the time(3) function (that is, seconds
from the Epoch, UTC).  mktime() interprets the input structure
to the current timezone setting (see tzset(3)).  timegm() interprets
input structure as representing Universal Coordinated Time (UTC). 
	The workaround is to set the time zone, as you did, but
	I suspect there's a better one: probably something
		if ((x = mktime(timeptr) != -1))
			x -= altzone;

	I'll ask My Smarter Colleagues[tm].

David Collier-Brown,           | Always do right. This will gratify 
Sun Microsystems DCMO          | some people and astonish the rest.
Toronto, Ontario               |
(905) 415-2849 or x52849       | davecb at

More information about the samba-technical mailing list