6 time_t cur_time, start, start_gmt, now, now_gmt;
9 double diff, part, days, hours, lon, lst;
12 cur_time = time(NULL);
14 printf("Time = %ld\n", cur_time);
16 gmt = gmtime(&cur_time);
18 printf("GMT = %d/%d/%2d %d:%02d:%02d\n",
19 gmt->tm_mon, gmt->tm_mday, gmt->tm_year,
20 gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
31 offset = -(timezone / 3600 - daylight);
33 printf("Raw time zone offset = %ld\n", timezone);
34 printf("Daylight Savings = %d\n", daylight);
36 printf("Local hours from GMT = %d\n", offset);
38 start_gmt = start - timezone + (daylight * 3600);
40 printf("March 21 noon (CST) = %ld\n", start);
41 printf("March 21 noon (GMT) = %ld\n", start_gmt);
43 for ( i = 0; i < 12; i++ ) {
46 mt.tm_year = gmt->tm_year;
53 offset = -(timezone / 3600 - daylight);
55 printf("Raw time zone offset = %ld\n", timezone);
56 printf("Daylight Savings = %d\n", daylight);
58 printf("Local hours from GMT = %d\n", offset);
60 now_gmt = now - timezone + (daylight * 3600);
62 printf("%d/%d/%d noon (CST) = %ld\n", i+1, 21, 97, now);
63 printf("%d/%d/%d noon (GMT) = %ld\n", i+1, 21, 97, now_gmt);
65 diff = (now_gmt - start_gmt) / (3600.0 * 24.0);
67 printf("Time since 3/21/%2d GMT = %.2f\n", gmt->tm_year, diff);
69 part = fmod(diff, 1.0);
71 /* hours = gmt->tm_hour + gmt->tm_min/60.0 + gmt->tm_sec/3600.0; */
75 lst = (days + lon)/15.0 + hours - 12;
81 printf("days = %.1f hours = %.2f lon = %.2f lst = %.2f\n",
82 days, hours, lon, lst);