mirror of
https://github.com/openbsd/src.git
synced 2024-12-21 23:18:00 -08:00
whitespace
This commit is contained in:
parent
84e87b2141
commit
0e2029b519
@ -10,13 +10,13 @@ that even if I was dumb enough to try. From this we can easily calculate
|
||||
the day of week for any date. The algorithm for a zero based day of week:
|
||||
|
||||
calculate the number of days in all prior years (year-1)*365
|
||||
add the number of leap years (days?) since year 1
|
||||
add the number of leap years (days?) since year 1
|
||||
(not including this year as that is covered later)
|
||||
add the day number within the year
|
||||
this compensates for the non-inclusive leap year
|
||||
calculation
|
||||
if the day in question occurs before the gregorian reformation
|
||||
(3 sep 1752 for our purposes), then simply return
|
||||
(3 sep 1752 for our purposes), then simply return
|
||||
(value so far - 1 + SATURDAY's value of 6) modulo 7.
|
||||
if the day in question occurs during the reformation (3 sep 1752
|
||||
to 13 sep 1752 inclusive) return THURSDAY. This is my
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: cal.c,v 1.31 2022/12/04 23:50:47 cheloha Exp $ */
|
||||
/* $OpenBSD: cal.c,v 1.32 2024/08/18 19:58:35 deraadt Exp $ */
|
||||
/* $NetBSD: cal.c,v 1.6 1995/03/26 03:10:24 glass Exp $ */
|
||||
|
||||
/*
|
||||
@ -261,7 +261,7 @@ week(int day, int month, int year)
|
||||
shift = 1;
|
||||
if (yearday < firstsunday)
|
||||
return (1);
|
||||
if (firstweekday > THURSDAY - 1)
|
||||
if (firstweekday > THURSDAY - 1)
|
||||
shift = 2;
|
||||
return ((((yearday + 1) - (weekday - 1)) / 7) + shift);
|
||||
}
|
||||
@ -291,7 +291,7 @@ isoweek(int day, int month, int year)
|
||||
return 53 - (g - s) / 5;
|
||||
else if (n > 364 + s)
|
||||
return 1;
|
||||
else
|
||||
else
|
||||
return n/7 + 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user