home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / adav313.zip / gnat-3_13p-os2-bin-20010916.zip / emx / gnatlib / a-cal.c < prev    next >
C/C++ Source or Header  |  2000-07-19  |  4KB  |  81 lines

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