Hello.

Very long time lurker, hello again.
(But do not ask me no questions.)

Dianne Skoll via Remind-fans wrote in
 <[email protected]>:
 |One other thing I should mention is that Remind has no way to know if
 |you use a valid time zone name.  That's because the POSIX API for
 |setting a timezone is (I kid you not...):
 |
 |        setenv("TZ", the_zone_name, 1);
 |        tzset();
 |
 |and tzset() returns void... there's no possible error return from
 |tzset()... not even errno.  This is not one of POSIX's shining moments.

I think it standardized what was in use at the end of the 80s.
(Ie Olson DB that later became the IANA TZ DB.)
All academics, who surely never misused $TZ (i would think).

 |On Linux with glibc, if you say:
 |
 |    REM TZ banana AT 00:00 MSG It's midnight, banana-time!
 |
 |then you get UTC.  I have no idea what happens on non-Linux systems.
 |If anyone knows of a portable and reliable way to validate a time zone
 |name for correctness, I'm all ears.

The IANA TZ DB can be compiled with "-DNETBSD_INSPIRED=1" to offer
tzalloc()/tzfree(), which returns NULL on invalid names.
Always available on NetBSD.  It could be it enters POSIX at some
later time, but it needs a sponsor, and should have seen adoption.
It can be used when available.

  timezone_t tzalloc(char const *);
  void tzfree(timezone_t);
+
  struct tm *localtime_rz(timezone_t restrict zone,
    time_t const *restrict clock, struct tm *restrict result);
  time_t mktime_z(timezone_t restrict zone,
    struct tm *restrict tm);

The BSD*s use the IANA TZ DB, though some via that "Joda" JAVA guy
after lots of turmoil on the IANA list (on zone merging in respect
to post 1970 time zone equality, even if that means certain
"countries" have to use the name of another "country").

This is about the data, the same is true for the code, but it
seems there are certain local patches, and sometimes newest code
is not (yet) integrated.  No tzalloc.

Other than that i do not know, first letter uppercase is a thing,
and some more cryptic string checks would be doable.

At least there is now the BSD stuff from the 80s in
_POSIX_C_SOURCE 202405L, namely struct tm::tm_{gmtoff,zone}.
Does not seem to help your code when i grep -i tz.  In fact quite
lengthy to also have a tzalloc() code path...

Ciao, and a nice Sunday, if you can; greetings from Germany,

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
_______________________________________________
Remind-fans mailing list
[email protected]
https://dianne.skoll.ca/mailman/listinfo/remind-fans
Remind is at https://dianne.skoll.ca/projects/remind/

Reply via email to