Skip to content

fix tzset cbindgen declarations

Ron Williams requested to merge rw_van_230506 into master

Includes a test, tzset.c.

The type declarations of extern variables were changed to conform as closely as possible to the libc spec for tzset. However, one non-conformance still exists. It should not be a problem as the generated "time.h" contains the actual declaration of the extern variables. The standard requires:

extern int daylight;
extern long timezone;
extern char *tzname[2];
void tzset(void);

The generated declaration is: (note the extra const and the CamelCase typename)

typedef const char *TzName[2];
extern TzName tzname;
extern int daylight;
extern long timezone;
void tzset(void);

If some C code includes "time.h" and declares extern char *tzname[2]; there will be a compilation error. Otherwise there should be no noticeable impact.

Merge request reports