1 #define _XOPEN_SOURCE /* glibc2 needs this */
5 #include "howmuchuseit.h"
7 int main(int argc, char *argv[])
12 char bf[1024], tms[1024];
14 long sum, dt, h, m, s;
16 delta = (24 * 3600) - atoi(argv[1]) * 3600;
19 while (fgets(bf, 1024, fp)) {
22 sscanf(bf, "%ld:%d", &dt, &len);
23 if (((dt + delta) / (24 * 3600)) != cur_d) {
26 cur_t = (time_t)(cur_d * (24 * 3600) - delta);
27 tmt = localtime((time_t *)&cur_t);
28 strftime(tms, 1024, "%Y-%m-%d", tmt);
30 m = (sum - (h * 3600)) / 60;
31 s = (sum - (h * 3600) - (m * 60));
32 printf(" %s | %02ld:%02ld:%02ld\n", tms, h, m, s);
35 cur_d = ((dt + delta) / (24 * 3600));
40 tmt = localtime((time_t *)&dt);
41 strftime(tms, 1024, "%Y-%m-%d", tmt);
43 m = (sum - (h * 3600)) / 60;
44 s = (sum - (h * 3600) - (m * 60));
45 printf(" %s | %02ld:%02ld:%02ld\n", tms, h, m, s);
50 printf("CTIME: %d\n", (int)t);
52 memset(&tm, 0, sizeof(struct tm));
53 strptime(argv[1], "%Y-%m-%d %H:%M:%S %Z", &tm);
55 printf(" TIME: %d\n", (int)t);
59 printf("GTIME: %d\n", (int)t);
61 tmout = localtime(&t);
63 printf("LTIME: %d\n", (int)t);