1
2 /* $selId: dow.c,v 2.0 1995/10/24 01:13:06 lees Exp $
3 * Copyright 1993-1995, Scott E. Lee, all rights reserved.
4 * Permission granted to use, copy, modify, distribute and sell so long as
5 * the above copyright and this permission statement are retained in all
6 * copies. THERE IS NO WARRANTY - USE AT YOUR OWN RISK.
7 */
8
9 /**************************************************************************
10 *
11 * These are the externally visible components of this file:
12 *
13 * int
14 * DayOfWeek(
15 * long int sdn);
16 *
17 * Convert a SDN to a day-of-week number (0 to 6). Where 0 stands for
18 * Sunday, 1 for Monday, etc. and 6 stands for Saturday.
19 *
20 * char *DayNameShort[7];
21 *
22 * Convert a day-of-week number (0 to 6), as returned from DayOfWeek(), to
23 * the abbreviated (three character) name of the day.
24 *
25 * char *DayNameLong[7];
26 *
27 * Convert a day-of-week number (0 to 6), as returned from DayOfWeek(), to
28 * the name of the day.
29 *
30 **************************************************************************/
31
32 #include "sdncal.h"
33
DayOfWeek(zend_long sdn)34 int DayOfWeek(
35 zend_long sdn)
36 {
37 int dow;
38
39 dow = (sdn + 1) % 7;
40 if (dow >= 0) {
41 return (dow);
42 } else {
43 return (dow + 7);
44 }
45 }
46
47 char *DayNameShort[7] =
48 {
49 "Sun",
50 "Mon",
51 "Tue",
52 "Wed",
53 "Thu",
54 "Fri",
55 "Sat"
56 };
57
58 char *DayNameLong[7] =
59 {
60 "Sunday",
61 "Monday",
62 "Tuesday",
63 "Wednesday",
64 "Thursday",
65 "Friday",
66 "Saturday"
67 };
68
69 /*
70 * Local variables:
71 * tab-width: 4
72 * c-basic-offset: 4
73 * End:
74 * vim600: sw=4 ts=4 fdm=marker
75 * vim<600: sw=4 ts=4
76 */
77