home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / rcs567s.zip / rcs / src / partime.h < prev    next >
C/C++ Source or Header  |  1993-11-09  |  2KB  |  75 lines

  1. /* Parse a string, yielding a struct partime that describes it.  */
  2.  
  3. /* Copyright 1993 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.  If not, write to
  20. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22. Report problems and direct all questions to:
  23.  
  24.     rcs-bugs@cs.purdue.edu
  25.  
  26. */
  27.  
  28. #define TM_UNDEFINED (-1)
  29. #define TM_DEFINED(x) (0 <= (x))
  30.  
  31. #define TM_UNDEFINED_ZONE (-24 * 60)
  32. #define TM_LOCAL_ZONE (TM_UNDEFINED_ZONE - 1)
  33.  
  34. struct partime {
  35.     /*
  36.     * This structure describes the parsed time.
  37.     * Only the following tm_* values in it are used:
  38.     *    sec, min, hour, mday, mon, year, wday, yday.
  39.     * If TM_UNDEFINED(value), the parser never found the value.
  40.     * The tm_year field is the actual year, not the year - 1900;
  41.     * but see ymodulus below.
  42.     */
  43.     struct tm tm;
  44.  
  45.     /*
  46.     * If !TM_UNDEFINED(ymodulus),
  47.     * then tm.tm_year is actually modulo ymodulus.
  48.     */
  49.     int ymodulus;
  50.  
  51.     /*
  52.     * Week of year, ISO 8601 style.
  53.     * If TM_UNDEFINED(yweek), the parser never found yweek.
  54.     * Weeks start on Mondays.
  55.     * Week 1 includes Jan 4.
  56.     */
  57.     int yweek;
  58.  
  59.     /* Minutes east of UTC; or TM_LOCAL_ZONE or TM_UNDEFINED_ZONE.  */
  60.     int zone;
  61. };
  62.  
  63. #if defined(__STDC__) || has_prototypes
  64. #    define __PARTIME_P(x) x
  65. #else
  66. #    define __PARTIME_P(x) ()
  67. #endif
  68.  
  69. #ifndef __STDC__
  70. #    define const
  71. #endif
  72.  
  73. char const *partime __PARTIME_P((char const *, struct partime *));
  74. char const *parzone __PARTIME_P((char const *, int *));
  75.