dtcm: Resolve CID 87822
[oweals/cde.git] / cde / programs / dtcm / libDtCmP / timeops.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /*******************************************************************************
24 **
25 **  timeops.h
26 **
27 **  static char sccsid[] = "@(#)timeops.h 1.10 94/11/07 Copyr 1991 Sun Microsystems, Inc.";
28 **
29 **  $XConsortium: timeops.h /main/3 1995/11/03 10:39:02 rswiston $
30 **
31 **  RESTRICTED CONFIDENTIAL INFORMATION:
32 **
33 **  The information in this document is subject to special
34 **  restrictions in a confidential disclosure agreement between
35 **  HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
36 **  document outside HP, IBM, Sun, USL, SCO, or Univel without
37 **  Sun's specific written approval.  This document and all copies
38 **  and derivative works thereof must be returned or destroyed at
39 **  Sun's request.
40 **
41 **  Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
42 **
43 *******************************************************************************/
44
45 /*                                                                      *
46  * (c) Copyright 1993, 1994 Hewlett-Packard Company                     *
47  * (c) Copyright 1993, 1994 International Business Machines Corp.       *
48  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.                      *
49  * (c) Copyright 1993, 1994 Novell, Inc.                                *
50  */
51
52 #ifndef _TIMEOPS_H
53 #define _TIMEOPS_H
54
55 #include <EUSCompat.h>
56 #include "ansi_c.h"
57
58 typedef enum {
59         minsec          = 60,
60         fivemins        = 300,
61         hrsec           = 3600,
62         daysec          = 86400,
63         wksec           = 604800,
64         yrsec           = 31536000,
65         leapyrsec       = 31622400
66 } Unit;
67
68 /* use time_t typedef for Tick, not a hardcoded long */
69 typedef time_t  Tick;           /* tick = seconds since epoch */
70
71 extern Tick     bot;            /* beginning of time */
72 extern char     *days[];
73 extern char     *days2[];
74 extern char     *days3[];
75 extern char     *days4[];
76 extern Tick     eot;            /* end of time */
77 extern char     *hours[];
78 extern int      monthdays[];
79 extern char     *months[];
80 extern char     *months2[];
81 extern int      monthsecs[];
82 extern char     *numbers[];
83
84 extern int      days_to_seconds         P((int));
85 extern int      dom                     P((Tick));
86 extern int      dow                     P((Tick));
87 extern int      fdom                    P((Tick));
88 extern Tick     first_dom               P((Tick));
89 extern Tick     first_dow               P((Tick));
90 extern Tick     get_eot                 P(());
91 extern Tick     get_bot                 P(());
92 extern long     gmt_off                 P(());
93 extern int      hour                    P((Tick));
94 extern int      hours_to_seconds        P((int));
95 extern void     init_time               P(());
96 extern Tick     jan1                    P((Tick));
97 extern Tick     last_dom                P((Tick));
98 extern Tick     last_dow                P((Tick));
99 extern Tick     last_ndays              P((Tick t, int));
100 extern int      lastapptofweek          P((u_int));
101 extern Tick     lastjan1                P((Tick));
102 extern int      ldom                    P((Tick));
103 extern Tick     lower_bound             P((int, Tick));
104 extern Tick     lowerbound              P((Tick));
105 extern boolean_t magic_time             P((Tick t));
106 extern Tick     midnight                P(());
107 extern int      minutes_to_seconds      P((int));
108 extern int      minute                  P((Tick));
109 extern int      month                   P((Tick));
110 extern Tick     monthdayyear            P((int, int, int));
111 extern int      monthlength             P((Tick));
112 extern Tick     next_ndays              P((Tick, int));
113 extern Tick     next_nhours             P((Tick, int));
114 extern Tick     next2weeks              P((Tick));
115 extern Tick     nextday                 P((Tick));
116 extern Tick     nextjan1                P((Tick));
117 extern Tick     nextmonth               P((Tick t));
118 extern Tick     next_nmonth             P((Tick t, int n));
119 extern Tick     nextmonth_exactday      P((Tick t));
120 extern Tick     nextweek                P((Tick t));
121 extern Tick     nextyear                P((Tick));
122 extern Tick     nextnyear               P((Tick t, int n));
123 extern Tick     now                     P(());
124 extern int      ntimes_this_week        P((u_int, int));
125 extern int      numwks                  P((Tick));
126 extern Tick     prev_nmonth             P((Tick t, int n));
127 extern Tick     prevmonth_exactday      P((Tick));
128 extern Tick     previousmonth           P((Tick t));
129 extern Tick     prevweek                P((Tick t));
130 extern Tick     prev2weeks              P((Tick t));
131 extern Tick     prevnyear               P((Tick t, int n));
132 extern int      seconds                 P((int n, Unit unit));
133 extern double   seconds_dble            P((double n, Unit unit));
134 extern int      seconds_to_days         P((int));
135 extern int      seconds_to_hours        P((int));
136 extern int      seconds_to_minutes      P((int));
137 extern int      seconds_to_weeks        P((int));
138 extern void     set_timezone            P((char*));
139 extern int      timeok                  P((Tick t));
140 extern Tick     upperbound              P((Tick));
141 extern int      weeks_to_seconds        P((int));
142 extern int      wom                     P((Tick));
143 extern boolean_t weekofmonth            P((Tick, int*));
144 extern Tick     xytoclock               P((int, int, Tick));
145 extern int      year                    P((Tick));
146 extern int      adjust_dst              P((Tick, Tick));
147 extern boolean_t adjust_hour            P((int*));
148 extern int      leapyr                  P((int));
149 extern Tick     prevday                 P((Tick));
150
151 #endif