| skipped 81 lines |
82 | 82 | | { |
83 | 83 | | assert(ptr1 != NULL && ptr2 != NULL); |
84 | 84 | | struct tm time_1, time_2; |
85 | | - | time_t t1, t2; |
| 85 | + | time_t t1, t2, now; |
| 86 | + | |
| 87 | + | now = time(NULL); |
| 88 | + | localtime_r(&now, &time_1); |
| 89 | + | localtime_r(&now, &time_2); |
86 | 90 | | |
87 | 91 | | strptime((*ptr1)->name, date_format, &time_1); |
88 | 92 | | strptime((*ptr2)->name, date_format, &time_2); |
| skipped 11 lines |
100 | 104 | | |
101 | 105 | | static bool summary_sort_is_alphabetic(const char *date_format) |
102 | 106 | | { |
103 | | - | const char *alphabetic_formats[] = {"%m", "%d", ""}; |
| 107 | + | const char *alphabetic_formats [] = {""}; |
104 | 108 | | |
105 | 109 | | for (int i = 0; i < CAG_ARRAY_SIZE(alphabetic_formats); ++i) { |
106 | 110 | | if (strcmp(alphabetic_formats[i], date_format) == 0) { |
| skipped 9 lines |
116 | 120 | | // Use bubble sort, since it doesn't allocate any memory. |
117 | 121 | | // (hopefully there aren't that many intervals.) |
118 | 122 | | int (*cmp)(const char *, ZiitSummaryInterval **, ZiitSummaryInterval **); |
| 123 | + | ZiitSummaryInterval **il, **ir; |
| 124 | + | |
119 | 125 | | if (summary_sort_is_alphabetic(date_format)) { |
120 | 126 | | cmp = summary_sort_compare_alphabetic; |
121 | 127 | | } else { |
122 | 128 | | cmp = summary_sort_compare_date; |
123 | 129 | | } |
124 | | - | ZiitSummaryInterval **il, **ir; |
| 130 | + | |
125 | 131 | | for (unsigned i = 0; i < response->n_intervals; ++i) { |
126 | 132 | | il = response->intervals + i; |
127 | 133 | | |
| skipped 34 lines |
162 | 168 | | printf("%s'%s'\n", from_buffer, sm_interval->name); |
163 | 169 | | |
164 | 170 | | snprintf(to_buffer, 255, "Entries:"); |
165 | | - | pad_right(to_buffer, 255, 10); |
| 171 | + | pad_right(to_buffer, 255, 11); |
166 | 172 | | printf("%s%li\n", to_buffer, sm_interval->group_entries); |
167 | 173 | | |
168 | 174 | | snprintf(from_buffer, 255, "TAG"); |
| skipped 125 lines |