OSDN Git Service

* reload1.c (reload_cse_simplify): Fix typo in rtx code check.
[pf3gnuchains/gcc-fork.git] / gcc / ada / cal.c
1 /****************************************************************************
2  *                                                                          *
3  *                         GNAT COMPILER COMPONENTS                         *
4  *                                                                          *
5  *                                   C A L                                  *
6  *                                                                          *
7  *                          C Implementation File                           *
8  *                                                                          *
9  *                                                                          *
10  *          Copyright (C) 1992-2001, Free Software Foundation, Inc.         *
11  *                                                                          *
12  * GNAT is free software;  you can  redistribute it  and/or modify it under *
13  * terms of the  GNU General Public License as published  by the Free Soft- *
14  * ware  Foundation;  either version 2,  or (at your option) any later ver- *
15  * sion.  GNAT is distributed in the hope that it will be useful, but WITH- *
16  * OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY *
17  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License *
18  * for  more details.  You should have  received  a copy of the GNU General *
19  * Public License  distributed with GNAT;  see file COPYING.  If not, write *
20  * to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, *
21  * MA 02111-1307, USA.                                                      *
22  *                                                                          *
23  * As a  special  exception,  if you  link  this file  with other  files to *
24  * produce an executable,  this file does not by itself cause the resulting *
25  * executable to be covered by the GNU General Public License. This except- *
26  * ion does not  however invalidate  any other reasons  why the  executable *
27  * file might be covered by the  GNU Public License.                        *
28  *                                                                          *
29  * GNAT was originally developed  by the GNAT team at  New York University. *
30  * It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). *
31  *                                                                          *
32  ****************************************************************************/
33
34 /*  This file contains those routines named by Import pragmas in package    */
35 /*  GNAT.Calendar. It is used to to Duration to timeval convertion.         */
36 /*  These are simple wrappers function to abstarct the fact that the C      */
37 /*  struct timeval fields type are not normalized (they are generaly        */
38 /*  defined as int or long values).                                         */
39
40 #if defined(VMS)
41
42 /* this is temporary code to avoid build failure under VMS */
43
44 void
45 __gnat_timeval_to_duration (void *t, long *sec, long *usec)
46 {
47 }
48
49 void
50 __gnat_duration_to_timeval (long sec, long usec, void *t)
51 {
52 }
53
54 #else
55
56 #if defined (__vxworks)
57 #include <sys/times.h>
58 #else
59 #include <sys/time.h>
60 #endif
61
62 void
63 __gnat_timeval_to_duration (struct timeval *t, long *sec, long *usec)
64 {
65   *sec  = (long) t->tv_sec;
66   *usec = (long) t->tv_usec;
67 }
68
69 void
70 __gnat_duration_to_timeval (long sec, long usec, struct timeval *t)
71 {
72   /* here we are doing implicit convertion from a long to the struct timeval
73      fields types. */
74
75   t->tv_sec = sec;
76   t->tv_usec = usec;
77 }
78 #endif
79
80 #ifdef __alpha_vxworks
81 #include "vxWorks.h"
82 #elif defined (__vxworks)
83 #include <types/vxTypesOld.h>
84 #endif
85
86 /* Return the value of the "time" C library function.  We always return
87    a long and do it this way to avoid problems with not knowing
88    what time_t is on the target.  */
89
90 long
91 gnat_time ()
92 {
93   return time (0);
94 }