mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Optimize out a loop
This commit is contained in:
parent
7b9e125e0c
commit
a20bba04d5
@ -2327,12 +2327,13 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
|
||||
RETURN_LONG(calc_sunset ? set : rise);
|
||||
}
|
||||
N = (calc_sunset ? h_set : h_rise) + gmt_offset;
|
||||
while (N > 24) {
|
||||
N -= 24;
|
||||
}
|
||||
while (N < 0) {
|
||||
N += 24;
|
||||
|
||||
if (N > 24) {
|
||||
N %= 24;
|
||||
} else if (N < 0) {
|
||||
N = N % 24 + 24;
|
||||
}
|
||||
|
||||
switch (retformat) {
|
||||
case SUNFUNCS_RET_STRING:
|
||||
spprintf(&retstr, 0, "%02d:%02d", (int) N, (int) (60 * (N - (int) N)));
|
||||
|
Loading…
Reference in New Issue
Block a user