partime.h 2.1 KB

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