Hi,

I wonder what is the simplest way to validate, from a C program, whether a 
given string can be successfully parsed as TZ (timezone) environment 
variable.

Thing is, tzset(3C) is not returning any error code. So if I putenv() 
something into TZ, and do the tzset() afterwards, it'll "do something". 
It'll simply set the global variables timezone/altzone/daylight/tzname[] 
to 0/0/0/{"GMT", "   "}.

But that's the same as specifying TZ=GMT (which is actually valid). So 
it's not sufficient just testing for the tuple above.

It seems the thing I need to do to validate something is a usable TZ 
environment variable is:

        - putenv(); tzset()
        - test for the above tuple
        - additionally validate tzname[0] != <my TZ string>

Any better ideas ?
Thx,

FrankH.


_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to