[tz] [PROPOSED] Draft next POSIX has tm_gmtoff, tm_zone

Paul Gilmartin PaulGBoulder at AIM.com
Sun Jan 14 20:14:56 UTC 2024


On 1/14/24 12:48:01, Paul Eggert via tz wrote:
> On 2024-01-14 08:16, Paul Gilmartin via tz wrote:
>> I hope the PROPOSED changes don't modify this.
> 
> You're OK, as the proposed changes don't affect your program's behavior. Your program always initializes the struct tm values via localtime_r, and it doesn't mess with TZ between calling localtime_r and calling strftime.
> .
No, I deliberately (and subtly) modified tm_year outside
localtime() to 2424-1900 by += 400.

I was trying to illustrate the question:
If I knot from sources outside my program and can set only
the members:
int    tm_sec   Seconds [0,60].
int    tm_min   Minutes [0,59].
int    tm_hour  Hour [0,23].
int    tm_mday  Day of month [1,31].
int    tm_mon   Month of year [0,11].
int    tm_year  Years since 1900.
int    tm_isdst Daylight Savings flag.
... plus the TZ environment variable.

How can I compute the corresponding value of %s or
seconds-since-the-epoch which I may need elsewhere in my program?
It must not depend on setting struct tm members which I want
the library functions to compute.

-- 
gil



More information about the tz mailing list