indent [ci skip]

This commit is contained in:
卜部昌平 2020-06-19 12:57:39 +09:00
parent 83f6de8691
commit ed6938ef50
Notes: git 2020-06-29 11:06:39 +09:00

114
time.c
View File

@ -3345,63 +3345,63 @@ find_time_t(struct tm *tptr, int utc_p, time_t *tp)
return NULL; return NULL;
found: found:
if (!utc_p) { if (!utc_p) {
/* If localtime is nonmonotonic, another result may exist. */ /* If localtime is nonmonotonic, another result may exist. */
time_t guess2; time_t guess2;
if (find_dst) { if (find_dst) {
guess2 = guess - 2 * 60 * 60; guess2 = guess - 2 * 60 * 60;
tm = LOCALTIME(&guess2, result); tm = LOCALTIME(&guess2, result);
if (tm) { if (tm) {
if (tptr->tm_hour != (tm->tm_hour + 2) % 24 || if (tptr->tm_hour != (tm->tm_hour + 2) % 24 ||
tptr->tm_min != tm->tm_min || tptr->tm_min != tm->tm_min ||
tptr->tm_sec != tm->tm_sec) { tptr->tm_sec != tm->tm_sec) {
guess2 -= (tm->tm_hour - tptr->tm_hour) * 60 * 60 + guess2 -= (tm->tm_hour - tptr->tm_hour) * 60 * 60 +
(tm->tm_min - tptr->tm_min) * 60 + (tm->tm_min - tptr->tm_min) * 60 +
(tm->tm_sec - tptr->tm_sec); (tm->tm_sec - tptr->tm_sec);
if (tptr->tm_mday != tm->tm_mday) if (tptr->tm_mday != tm->tm_mday)
guess2 += 24 * 60 * 60; guess2 += 24 * 60 * 60;
if (guess != guess2) { if (guess != guess2) {
tm = LOCALTIME(&guess2, result); tm = LOCALTIME(&guess2, result);
if (tm && tmcmp(tptr, tm) == 0) { if (tm && tmcmp(tptr, tm) == 0) {
if (guess < guess2) if (guess < guess2)
*tp = guess; *tp = guess;
else else
*tp = guess2; *tp = guess2;
return NULL; return NULL;
} }
} }
} }
} }
} }
else { else {
guess2 = guess + 2 * 60 * 60; guess2 = guess + 2 * 60 * 60;
tm = LOCALTIME(&guess2, result); tm = LOCALTIME(&guess2, result);
if (tm) { if (tm) {
if ((tptr->tm_hour + 2) % 24 != tm->tm_hour || if ((tptr->tm_hour + 2) % 24 != tm->tm_hour ||
tptr->tm_min != tm->tm_min || tptr->tm_min != tm->tm_min ||
tptr->tm_sec != tm->tm_sec) { tptr->tm_sec != tm->tm_sec) {
guess2 -= (tm->tm_hour - tptr->tm_hour) * 60 * 60 + guess2 -= (tm->tm_hour - tptr->tm_hour) * 60 * 60 +
(tm->tm_min - tptr->tm_min) * 60 + (tm->tm_min - tptr->tm_min) * 60 +
(tm->tm_sec - tptr->tm_sec); (tm->tm_sec - tptr->tm_sec);
if (tptr->tm_mday != tm->tm_mday) if (tptr->tm_mday != tm->tm_mday)
guess2 -= 24 * 60 * 60; guess2 -= 24 * 60 * 60;
if (guess != guess2) { if (guess != guess2) {
tm = LOCALTIME(&guess2, result); tm = LOCALTIME(&guess2, result);
if (tm && tmcmp(tptr, tm) == 0) { if (tm && tmcmp(tptr, tm) == 0) {
if (guess < guess2) if (guess < guess2)
*tp = guess2; *tp = guess2;
else else
*tp = guess; *tp = guess;
return NULL; return NULL;
} }
} }
} }
} }
} }
} }
*tp = guess; *tp = guess;
return NULL; return NULL;
out_of_range: out_of_range:
return "time out of range"; return "time out of range";