Hallo,
On Tue, 01 Apr 2003, Jan Trippler wrote:
On Die, 01 Apr 2003 at 19:16 (+0200), bb@kisters.de wrote:
Am 31.03.2003 21:40:05 schrieb Jan.Trippler:
[Zeitzone sichern]
tzset() ;
sprintf(tzstd, "%.3s%li%.3s", tzname[0], timezone/3600, tzname[1]);
Zitat aus *man tzset*:
<schnipp>
If the TZ variable does appear in the environment but its
value is NULL or its value cannot be interpreted using any
of the formats specified below, Coordinated Universal Time
(UTC) is used.
<schnapp>
tzset ist ja sowieso nicht unbedingt das Mittel der Wahl...
Verwenden sollte man dann wohl die ueblichen Funktionen wie localtime,
strftime usw...
Was das "sichern" usw. von TZ angeht:
====
#include
#include
int main(int argc, char * argv[]) {
char * TZ;
char * oldTZ;
/* save old string */
TZ = getenv("TZ");
oldTZ = TZ;
printf("%p: '%s'\n%p: '%s'\n", TZ, TZ, oldTZ, oldTZ);
/* set new string */
printf("setenv = %i\n", setenv("TZ", "UTC", 1));
TZ = getenv("TZ");
printf("%p: '%s'\n%p: '%s'\n", TZ, TZ, oldTZ, oldTZ);
/* restore original string */
printf("setenv = %i\n", setenv("TZ", oldTZ, 1));
TZ = getenv("TZ");
printf("%p: '%s'\n%p: '%s'\n", TZ, TZ, oldTZ, oldTZ);
return 0;
}
====
-dnh
--
Versäumen sie nicht den neuen Film von Albert B. Blumenkohl
---===### "To live and let rub" ###===---
Aus dem Inhalt:
"Mein Name ist Gross. Flo Gross. Mein Schlauch auch. Geben Sie mir
eine Kampflesbe bitte, eine gerührte. Nein, geschüttelt. Wo ich sie
doch viel lieber gerieben hätte." [Sig von 'Moss' in suse-talk]