1 #include <stdio.h>
2 #include <time.h>
3
4 int main(int argc, char **argv) {
5 time_t t1, t2, base_t;
6 double offset = 0;
7
8 base_t = time(NULL);
9 t1 = mktime(gmtime(&base_t));
10 t2 = mktime(localtime(&base_t));
11 offset = difftime(t2, t1);
12
13 printf("Local Time Zone offset = %0.3f seconds (%0.3f hours)\n", offset, offset / 3600.0);
14
15 return 0;
16 }
17
沒有留言:
發佈留言