381d7de565425ee1c5892efb2b6fc80243bc3652
[gnulib.git] / lib / sys_times.in.h
1 /* Provide a sys/times.h header file.
2    Copyright (C) 2008 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2, or (at your option)
7    any later version.
8
9    This program 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
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software Foundation,
16    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
17
18 /* Written by Simon Josefsson <simon@josefsson.org>, 2008.  */
19
20 /* This file is supposed to be used on platforms where <sys/times.h>
21    is missing.  */
22
23 #ifndef _GL_SYS_TIMES_H
24 # define _GL_SYS_TIMES_H
25
26 /* Get clock_t. */
27 # include <time.h>
28
29 /* The definition of GL_LINK_WARNING is copied here.  */
30
31 # ifdef __cplusplus
32 extern "C" {
33 # endif
34
35   /* Structure describing CPU time used by a process and its children.  */
36   struct tms
37   {
38     clock_t tms_utime;          /* User CPU time.  */
39     clock_t tms_stime;          /* System CPU time.  */
40
41     clock_t tms_cutime;         /* User CPU time of dead children.  */
42     clock_t tms_cstime;         /* System CPU time of dead children.  */
43   };
44
45 # if @GNULIB_TIMES@
46   extern clock_t times (struct tms *buffer);
47 # elif defined GNULIB_POSIXCHECK
48 #  undef times
49 #  define times(s)                                              \
50   (GL_LINK_WARNING ("times is unportable - "                    \
51                     "use gnulib module times for portability"), \
52    times (s))
53 # endif
54
55 # ifdef __cplusplus
56 }
57 # endif
58
59 #endif                          /* _GL_SYS_TIMES_H */