/* lokale Zeitdarstellung */ /* Datei: loctime.c */ #include #include #include #include int main(void) { struct tm *zeitstru; time_t unixsekunden; char str[80]; if ((setlocale (LC_ALL,"de_DE.437")) == NULL) { fprintf(stderr,"\nKann Schauplatz nicht finden\n"); exit (5); } printf ("\nZeit: %s",getenv("TZ")); tzset(); /* nicht ANSI */ printf ("\nDaylight: %d",daylight); /* nicht ANSI */ printf ("\nZeitdifferenz: %ld",timezone); printf ("\nZeitzone: %s",tzname[0]); unixsekunden = time(NULL); zeitstru = localtime(&unixsekunden); strftime(str, 80, "\nEs ist %M Minuten nach %I Uhr " "(%Z) %A, %B %d 19%y", zeitstru); printf("%s\n",str); return 0; }