/* * Taken from comp.unix.aix * From: John Crothers * Subject: strptime() and %y checker */ #ifndef lint static char *_version = "@(#)strptime_win.c 1.1 - 98/05/04"; #endif /* * Determine window for the strptime(3C) function. */ #include #include #include #ifdef sun #include #else #define TM_YEAR_BASE 1900 #endif main() { int i; struct tm tm; char buf[4]; int years[100]; for (i = 0; i < 100; i++) { sprintf(buf, "%02d", i); (void) strptime(buf, "%y", &tm); years[i] = tm.tm_year + TM_YEAR_BASE; } printf("strptime(3C) window: %04d-", years[0]); for (i = 1; i < 100; i++) { if (years[i-1] / 100 != years[i] / 100) printf("%04d %04d-", years[i-1], years[i]); } printf("%04d\n", years[99]); exit(0); return (0); /* quiet lint gripes */ }