Last change
on this file since a838f5b was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago |
Imported original source code.
|
-
Property mode
set to
100755
|
File size:
564 bytes
|
Line | |
---|
1 | /*
|
---|
2 | =============================================================================
|
---|
3 | weekof.c -- return the Monday of the week a given Julian day is in
|
---|
4 | Version 1 -- 1988-01-20 -- D.N. Lynx Crowe
|
---|
5 |
|
---|
6 | Accepts and returns Julian day numbers as used with jdate() or jday().
|
---|
7 | =============================================================================
|
---|
8 | */
|
---|
9 |
|
---|
10 | #include "stddefs.h"
|
---|
11 |
|
---|
12 | long
|
---|
13 | weekof(jd)
|
---|
14 | long jd;
|
---|
15 | {
|
---|
16 | short wd;
|
---|
17 |
|
---|
18 | wd = (jd + 1L) % 7;
|
---|
19 |
|
---|
20 | if (wd EQ 1)
|
---|
21 | return(jd);
|
---|
22 | else if (wd)
|
---|
23 | return(jd - (long)(wd - 1));
|
---|
24 | else
|
---|
25 | return(jd - 6L);
|
---|
26 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.