111891Speter/* Parse a string, yielding a struct partime that describes it. */ 211891Speter 311891Speter/* Copyright 1993, 1994, 1995 Paul Eggert 411891Speter Distributed under license by the Free Software Foundation, Inc. 511891Speter 611891SpeterThis file is part of RCS. 711891Speter 811891SpeterRCS is free software; you can redistribute it and/or modify 911891Speterit under the terms of the GNU General Public License as published by 1011891Speterthe Free Software Foundation; either version 2, or (at your option) 1111891Speterany later version. 1211891Speter 1311891SpeterRCS is distributed in the hope that it will be useful, 1411891Speterbut WITHOUT ANY WARRANTY; without even the implied warranty of 1511891SpeterMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1611891SpeterGNU General Public License for more details. 1711891Speter 1811891SpeterYou should have received a copy of the GNU General Public License 1911891Speteralong with RCS; see the file COPYING. 2011891SpeterIf not, write to the Free Software Foundation, 2111891Speter59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 2211891Speter 2311891SpeterReport problems and direct all questions to: 2411891Speter 2511891Speter rcs-bugs@cs.purdue.edu 2611891Speter 2711891Speter*/ 2811891Speter 2911891Speter#define TM_UNDEFINED (-1) 3011891Speter#define TM_DEFINED(x) (0 <= (x)) 3111891Speter 3211891Speter#define TM_UNDEFINED_ZONE ((long) -24 * 60 * 60) 3311891Speter#define TM_LOCAL_ZONE (TM_UNDEFINED_ZONE - 1) 3411891Speter 3511891Speterstruct partime { 3611891Speter /* 3711891Speter * This structure describes the parsed time. 3811891Speter * Only the following tm_* values in it are used: 3911891Speter * sec, min, hour, mday, mon, year, wday, yday. 4011891Speter * If TM_UNDEFINED(value), the parser never found the value. 4111891Speter * The tm_year field is the actual year, not the year - 1900; 4211891Speter * but see ymodulus below. 4311891Speter */ 4411891Speter struct tm tm; 4511891Speter 4611891Speter /* 4711891Speter * If !TM_UNDEFINED(ymodulus), 4811891Speter * then tm.tm_year is actually modulo ymodulus. 4911891Speter */ 5011891Speter int ymodulus; 5111891Speter 5211891Speter /* 5311891Speter * Week of year, ISO 8601 style. 5411891Speter * If TM_UNDEFINED(yweek), the parser never found yweek. 5511891Speter * Weeks start on Mondays. 5611891Speter * Week 1 includes Jan 4. 5711891Speter */ 5811891Speter int yweek; 5911891Speter 6011891Speter /* Seconds east of UTC; or TM_LOCAL_ZONE or TM_UNDEFINED_ZONE. */ 6111891Speter long zone; 6211891Speter}; 6311891Speter 6411891Speter#if defined(__STDC__) || has_prototypes 6511891Speter# define __PARTIME_P(x) x 6611891Speter#else 6711891Speter# define __PARTIME_P(x) () 6811891Speter#endif 6911891Speter 7011891Speterchar *partime __PARTIME_P((char const *, struct partime *)); 7111891Speterchar *parzone __PARTIME_P((char const *, long *)); 72