MCPcopy Create free account
hub / github.com/eggert/tz / timerange_option

Function timerange_option

zic.c:1165–1189  ·  view source on GitHub ↗

Set the time range of the output to TIMERANGE. Return true if successful. */

Source from the content-addressed store, hash-verified

1163static bool
1164timerange_option(char *timerange)
1165{
1166 intmax_t lo = min_time, hi = max_time;
1167 char *lo_end = timerange, *hi_end;
1168 if (*timerange == '@') {
1169 errno = 0;
1170 lo = strtoimax(timerange + 1, &lo_end, 10);
1171 if (lo_end == timerange + 1 || (lo == INTMAX_MAX && errno == ERANGE))
1172 return false;
1173 }
1174 hi_end = lo_end;
1175 if (lo_end[0] == '/' && lo_end[1] == '@') {
1176 errno = 0;
1177 hi = strtoimax(lo_end + 2, &hi_end, 10);
1178 if (hi_end == lo_end + 2 || hi == INTMAX_MIN)
1179 return false;
1180 hi -= ! (hi == INTMAX_MAX && errno == ERANGE);
1181 }
1182 if (*hi_end || hi < lo || max_time < lo || hi < min_time)
1183 return false;
1184 lo_time = max(lo, min_time);
1185 hi_time = min(hi, max_time);
1186 return true;
1187}
1188
1189/* Generate redundant time stamps up to OPT. Return true if successful. */
1190static bool
1191redundant_time_option(char *opt)
1192{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected