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