[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] [ANNOUNCE:] leafnode-1.9.12



On Sun, Apr 02, 2000 at 01:03:25AM -0500, Curly wrote:
> > This is clearly non-portable. TZ isn't set here, and I would
> never
> > rely on any environment variable, esp. if your program runs as a
> > system user (news in this case).
> What's "here"?  I'm running RedHat 6.x for all x,  I have AIX 4.1
> and Interactive Unix 3.2.  I can only speak to portability within
> these bounds.

It is not set on my Redhat 6.1 and on the Digital Unix I have
access to. It is set to US/Eastern on the SunOS 5.6 I know.

> On these systems, TZ is the final word on time zones.  There is a
> fallback to a system setting in a file in /etc/localtime that is
> used if TZ is unset.  I'm not sure if Interactive supports

No /etc/localtime on Digital Unix.

> TZ is about as portable as anything in *nix.

I.e. not at all :-)

> Being a "system user" does not allow you to ignore the inputs
> used by a library function.  For example, in AIX the sysadmin can

I was talking about environment variables, not library functions.

> edit a file which contains the initial environment for any new
> login or system program.  The sysadmin may set TZ in this file.
> Read `man environment` on AIX.  I haven't seen this on other
> systems, but there's some wierd stuff out there!

I don't have AIX and it's obviously non-portable.

> > - Does time( NULL ) return seconds since the epoch in local
> time?
> >   (Yes according to MA)
> No, according to the man pages on my systems.

No, according to my man pages. Yes, according to my experiments.
But I'm confused. That's why ask this.

> I verified this on Linux with a program that twiddled TZ and
> printed both the decimal and decoded values of time().

Ok, one question answered.

> > - Is tm_gmtoff "time(NULL, UTC) - time(NULL, local time)" or
> vice
> >   versa?
> This doesn't exist on Interactive or on AIX. 
[...]
> it is obviously not portable.

We know this. That's why we have the #ifdef HAVE_GMTOFF in the
code and use timezone for the ones that don't have it.

> I would suggest instead building a function to construct the
> value.  That would be portable to any *nix unless there is one
> out there that does not use TZ?

Do you realize how many timezones are out there, all with their
own rule for DST?

BTW C99 specifies a structure tmx with a member int tm_zone, 
time zone offset in minutes from UTC [-1439:1439] with a positive
value that is ahead of UTC. Anyone has that?

Regards,
	Jo:rg

-- 
Fortune cookie of the day:
Time to take stock.  Go home with some office supplies.

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list