[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 05:34:24PM -0400, Curly wrote:
> 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.

Ok, I'm convinced now. I even found /etc/zoneinfo/localtime on
the Digital Unix. Seems I shouldn't write mail past my bedtime.
(I also found that tm_gmtoff is positive east of Greenwich, if we
still want to use that.)

> If tzset doesn't link, remove that line and try again to see if

tzset links, just snprintf doesn't...

> 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.

Yep. The DU man pages are also much clearer. Should have studied
them before in more detail.

> > Do you realize how many timezones are out there, all with their
> > own rule for DST?
> Huh?  I'm confused.  

Then I'm not alone anymore :-)

> I thought this was needed to figure out the difference for the 
> local machine.

It is. I probably misundertood you. 

Putting your code and my own thoughts (dangerous!) together I get
the following function:

time_t gmtoff( void ) {
    time_t localsec, gmtsec;
    time_t now;
    struct tm *ltime;
    char *zone;
    char *oldzone;
    int len;

    now = time( 0 );
    ltime = localtime( &now );

    zone = getenv( "TZ" );    /* save current offset */
    localsec = mktime( ltime );

    len = 4 + (zone ? strlen(zone) : 0);
    oldzone = (char*)calloc( len, sizeof( char ) );
    snprintf( oldzone, len, "TZ=%s", zone ? zone : "" );
    putenv( "TZ=GMT" );            /* use mktime to create UTC */
    gmtsec = mktime( ltime );


    return( gmtsec - localsec );

With a positive value east of Greenwich. The correct line in 
donewgroups() would then be:

age = mktime( &timearray ) - (strstr( arg, "GMT" ) ? gmtoff() : 0 );

gmtoff() shouldn't be called everytime, of course, but only once
when the programm starts and its value should be written to
global variable. This works on leafnode-2.0a14 and shouldn't be
different from 1.9.12.

Comments anyone? Can someone please test this?

Thanks for your explanations. They were really helpful.


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