C语言基础:timezone名字显示
#include <stdio.h> #include <time.h> int main(void) { tzset(); printf("Current time zone is %s\n", tzname[0]); if (tzname[1]) printf("Daylight savings zone is %s\n", tzname[1]); else printf("Daylight savings zone is not defined\n"); return 1; }
显示结果
Current time zone is CST Daylight savings zone is CDT