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

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

From: Joerg Dietrich <joerg@xxxxxxxxxxxx>

> 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
> > and Interactive Unix 3.2.  I can only speak to portability
> > 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.

Not set and not present doesn't mean not used.  I'm running all
three RH 6.x and see no difference in this regard.  Most of my
testing for this was done on my main home system, 6.0, but I
verified that the same things are on the 6.2 I installed last

My Interactive Unix also does not document tzset and
/etc/localtime, but ISTR that they didn't have a valid copy of
the localtime file but do support it if provided by the customer.
They do include tzset, but I had to write a little program to be
sure that it was actually there.

Please compile and run this program on your Digital Unix to prove
that TZ is not the master of time.  If it's not, it will be the
first *nix compatible environment I've ever heard of without it,
and I'm including M$'s stuff in that statement.

If tzset doesn't link, remove that line and try again to see if
TZ is read without using a public function called tzset.

#include "stdio.h"
#include "stdlib.h"
#include "time.h"
void showtime( time_t* sec,  char* zone )
    printf( "%10s:  %10ld  %s", zone, *sec, ctime(sec) );
void showzone( time_t* sec,  char* zone )
    char buf[12];
    snprintf( buf, sizeof(buf), "TZ=%s", zone );

    putenv( buf );
    showtime( sec, zone );
    showtime( sec, zone );
int main( void )
    time_t now = time(0);
    printf( "  timezone      time(0)  ----ctime----\n\n" );
    showtime( &now, "default" );

    showzone( &now, "EST5" );
    showzone( &now, "GMT0" );
    showzone( &now, "GMT-5" );

    tzset();  // does naught but prove tzset links in.
    return 0;

> > 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
> > used if TZ is unset.  I'm not sure if Interactive supports
> No /etc/localtime on Digital Unix.

So?  I only mentioned it to explain why 99% of users don't need
to set TZ any more.

> > TZ is about as portable as anything in *nix.
> I.e. not at all :-)

Au contraire.  I have yet to find a system that does not use it.

> > Being a "system user" does not allow you to ignore the inputs
> > used by a library function.  For example, in AIX the sysadmin
> I was talking about environment variables, not library

<sigh>  You cannot talk intelligently about a library function
and ignore the inputs it uses.  This is from `man tzset` on
RH 6.0:

    The  tzset() function initializes the tzname variable from
    the TZ environment variable.  This function  is  automati-
    cally  called  by the other time conversion functions that
    depend on the time zone.

So the inputs to mktime are on RedHat 6.0 are:
 a) a pointer to a filled-in tm structure
 b) the environment variable TZ
 c) /etc/localtime

You cannot ignore (b) and (c) just because you didn't spell them
out in your source code.

Make no mistake, this stuff *IS* confusing.  I've probably spent
6 hours this weekend comparing manpages and writing little test
programs to see if I understand them.  It seems that modern man
pages have been re-written in double-speek for the sole purpose
selling books that do nothing but explain the stuff that's in
the man pages.  In fact, I've decided that when we turn off our
last Interactive Unix system, I'm going to have a special man
page tree with the old, readable man pages.  They helped me sort
through this mess.

> > edit a file which contains the initial environment for any new
> > login or system program.  The sysadmin may set TZ in this
> > 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.


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

Huh?  I'm confused.  I thought this was needed to figure out the
difference for the local machine.  If you need to figure out the
difference for each message, isn't the offset included in the
header?  Ok, I have to go back and reread this entire thread.  I
skimmed a lot reading the archive before joining the list.
<sigh> RL calls, later...

Oisin  "Curly++"  Curtin                     ocurtin@SPAM@usa.net
Surface Liaison, Minetown Digger                    Send no SPAM@

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