xref: /netbsd-src/external/gpl2/rcs/dist/src/partime.h (revision fa28c6faa16e0b00edee7acdcaf4899797043def)
1 /*	$NetBSD: partime.h,v 1.2 2016/01/14 04:22:39 christos Exp $	*/
2 
3 /* Parse a string, yielding a struct partime that describes it.  */
4 
5 /* Copyright 1993, 1994, 1995 Paul Eggert
6    Distributed under license by the Free Software Foundation, Inc.
7 
8 This file is part of RCS.
9 
10 RCS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
13 any later version.
14 
15 RCS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with RCS; see the file COPYING.
22 If not, write to the Free Software Foundation,
23 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 
25 Report problems and direct all questions to:
26 
27     rcs-bugs@cs.purdue.edu
28 
29 */
30 
31 #define TM_UNDEFINED (-1)
32 #define TM_DEFINED(x) (0 <= (x))
33 
34 #define TM_UNDEFINED_ZONE ((long) -24 * 60 * 60)
35 #define TM_LOCAL_ZONE (TM_UNDEFINED_ZONE - 1)
36 
37 struct partime {
38 	/*
39 	* This structure describes the parsed time.
40 	* Only the following tm_* values in it are used:
41 	*	sec, min, hour, mday, mon, year, wday, yday.
42 	* If TM_UNDEFINED(value), the parser never found the value.
43 	* The tm_year field is the actual year, not the year - 1900;
44 	* but see ymodulus below.
45 	*/
46 	struct tm tm;
47 
48 	/*
49 	* If !TM_UNDEFINED(ymodulus),
50 	* then tm.tm_year is actually modulo ymodulus.
51 	*/
52 	int ymodulus;
53 
54 	/*
55 	* Week of year, ISO 8601 style.
56 	* If TM_UNDEFINED(yweek), the parser never found yweek.
57 	* Weeks start on Mondays.
58 	* Week 1 includes Jan 4.
59 	*/
60 	int yweek;
61 
62 	/* Seconds east of UTC; or TM_LOCAL_ZONE or TM_UNDEFINED_ZONE.  */
63 	long zone;
64 };
65 
66 #if defined(__STDC__) || has_prototypes
67 #	define __PARTIME_P(x) x
68 #else
69 #	define __PARTIME_P(x) ()
70 #endif
71 
72 char *partime __PARTIME_P((char const *, struct partime *));
73 char *parzone __PARTIME_P((char const *, long *));
74