time.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* $OpenBSD: time.h,v 1.18 2006/01/06 18:53:04 millert Exp $ */
  2. /* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */
  3. /*
  4. * Copyright (c) 1989 The Regents of the University of California.
  5. * All rights reserved.
  6. *
  7. * (c) UNIX System Laboratories, Inc.
  8. * All or some portions of this file are derived from material licensed
  9. * to the University of California by American Telephone and Telegraph
  10. * Co. or Unix System Laboratories, Inc. and are reproduced herein with
  11. * the permission of UNIX System Laboratories, Inc.
  12. *
  13. * Redistribution and use in source and binary forms, with or without
  14. * modification, are permitted provided that the following conditions
  15. * are met:
  16. * 1. Redistributions of source code must retain the above copyright
  17. * notice, this list of conditions and the following disclaimer.
  18. * 2. Redistributions in binary form must reproduce the above copyright
  19. * notice, this list of conditions and the following disclaimer in the
  20. * documentation and/or other materials provided with the distribution.
  21. * 3. Neither the name of the University nor the names of its contributors
  22. * may be used to endorse or promote products derived from this software
  23. * without specific prior written permission.
  24. *
  25. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  26. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  29. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  30. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  31. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  32. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  33. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  34. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  35. * SUCH DAMAGE.
  36. *
  37. * @(#)time.h 5.12 (Berkeley) 3/9/91
  38. */
  39. #ifndef _TIME_H_
  40. #define _TIME_H_
  41. #include <sys/cdefs.h>
  42. #include <sys/_types.h>
  43. #ifndef NULL
  44. #ifdef __cplusplus
  45. #define NULL 0
  46. #else
  47. #define NULL ((void *)0)
  48. #endif
  49. #endif
  50. #if !defined (_CLOCK_T_DEFINED_) && !defined (_CLOCK_T_DEFINED)
  51. #define _CLOCK_T_DEFINED_
  52. #define _CLOCK_T_DEFINED
  53. typedef __clock_t clock_t;
  54. #endif
  55. #if !defined (_TIME_T_DEFINED_) && !defined (_TIME_T_DEFINED)
  56. #define _TIME_T_DEFINED_
  57. #define _TIME_T_DEFINED
  58. typedef __time_t time_t;
  59. #endif
  60. #if !defined (_SIZE_T_DEFINED_) && !defined (_SIZE_T_DEFINED)
  61. #define _SIZE_T_DEFINED_
  62. #define _SIZE_T_DEFINED
  63. typedef __size_t size_t;
  64. #endif
  65. #if !defined (_TM_DEFINED)
  66. #define _TM_DEFINED
  67. struct tm {
  68. int tm_sec; /* seconds after the minute [0-60] */
  69. int tm_min; /* minutes after the hour [0-59] */
  70. int tm_hour; /* hours since midnight [0-23] */
  71. int tm_mday; /* day of the month [1-31] */
  72. int tm_mon; /* months since January [0-11] */
  73. int tm_year; /* years since 1900 */
  74. int tm_wday; /* days since Sunday [0-6] */
  75. int tm_yday; /* days since January 1 [0-365] */
  76. int tm_isdst; /* Daylight Saving Time flag */
  77. /* FIXME: naming issue exists on Fedora/Ubuntu */
  78. long tm_gmtoff; /* offset from UTC in seconds */
  79. char *tm_zone; /* timezone abbreviation */
  80. };
  81. #endif
  82. __BEGIN_DECLS
  83. double _TLIBC_CDECL_ difftime(time_t, time_t);
  84. char * _TLIBC_CDECL_ asctime(const struct tm *);
  85. size_t _TLIBC_CDECL_ strftime(char *, size_t, const char *, const struct tm *);
  86. /*
  87. * Non-C99
  88. */
  89. char * _TLIBC_CDECL_ asctime_r(const struct tm *, char *);
  90. __END_DECLS
  91. #endif /* !_TIME_H_ */