baur@spp2.UUCP (Steven L. Baur) (02/26/89)
From the UNIXPC Users Manual Volume II for ctime(3C) "... the external variable daylight is non-zero if and only if the standard USA Daylight Savings Time conversion should be applied." Why is it one (1) now (it's PST here)? The field tm_isdst is correct though (when taken on a time now). steve uunet!wiley!spp2!baur
guy@auspex.UUCP (Guy Harris) (02/28/89)
>From the UNIXPC Users Manual Volume II for ctime(3C) >"... the external variable daylight is non-zero if and only if the standard >USA Daylight Savings Time conversion should be applied." > >Why is it one (1) now (it's PST here)? Because the standard USA Daylight Savings Time conversion should be applied. Said conversion, in recent times, shifts the clock by one hour between the first Sunday in April, 2AM local time, and the last Sunday in October, 2AM local time. Since the current time is not in that range, the clock is not shifted. >The field tm_isdst is correct though (when taken on a time now). Another way of looking at this is that "daylight" is static and "tm_isdst" is dynamic. In other words, "daylight" merely indicates whether your locale *observes* DST, not that DST is *currently* in effect; "tm_isdst" indicates whether DST is in effect for the time converted. I.e., "daylight" probably *does* work on the UNIX PC, and every other version of UNIX running code of that sort; it just doesn't work the way you thought it was supposed to.
ditto@cbmvax.UUCP (Michael "Ford" Ditto) (02/28/89)
In article <1667@spp2.UUCP> baur@spp2.UUCP (Steven L. Baur) writes: >From the UNIXPC Users Manual Volume II for ctime(3C) >"... the external variable daylight is non-zero if and only if the standard >USA Daylight Savings Time conversion should be applied." > >Why is it one (1) now (it's PST here)? Because the standard conversion rules *should* be applied where you live. `daylight', like `timezone', has nothing to do with the current time, it's just an indication of how the timezone rules work in your area. The standard conversion says that at this time of year, it's Standard time; that's why localtime() will tell you PST. If `daylight' == 0, then localtime() will *never* report DST, no matter what time of year the passed time is within. >The field tm_isdst is correct though (when taken on a time now). Yes, the tm_isdst field reflects whether the given time falls within Daylight Savings Time. `daylight' specifies whether the user's area even has any concept of DST; it's true iff $TZ has nonnumeric characters after the numeric part. -- -=] Ford [=- "The number of Unix installations (In Real Life: Mike Ditto) has grown to 10, with more expected." ford@kenobi.cts.com - The Unix Programmer's Manual, ...!sdcsvax!crash!kenobi!ford 2nd Edition, June, 1972. ditto@cbmvax.commodore.com