os_time.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    os_time.h
00006  *
00007  *  time types
00008  *
00009  *  os_time.h,v 1.15 2006/06/20 12:40:38 jwillemsen Exp
00010  *
00011  *  @author Don Hinton <dhinton@dresystems.com>
00012  *  @author This code was originally in various places including ace/OS.h.
00013  */
00014 //=============================================================================
00015 
00016 #ifndef ACE_OS_INCLUDE_OS_TIME_H
00017 #define ACE_OS_INCLUDE_OS_TIME_H
00018 
00019 #include /**/ "ace/pre.h"
00020 
00021 #include "ace/config-lite.h"
00022 
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif /* ACE_LACKS_PRAGMA_ONCE */
00026 
00027 // @todo should we include anything from signal.h?
00028 #include "ace/os_include/sys/os_types.h"
00029 
00030 // To get the proper select() signature, this is required for HP-UX, and
00031 // maybe other platforms that offer both int and fdset forms of select().
00032 // For HP-UX, sys/time.h must be included before time.h, or
00033 // _XOPEN_SOURCE_EXTENDED must be defined. It's not nice to require
00034 // the preprocessor macro, so we force our select() preference this way.
00035 #if !defined (ACE_LACKS_SYS_TIME_H)
00036 #  include /**/ <sys/time.h>
00037 #endif /* !ACE_LACKS_SYS_TIME_H */
00038 
00039 #if !defined (ACE_LACKS_TIME_H)
00040 #  include /**/ <time.h>
00041 #endif /* !ACE_LACKS_TIME_H */
00042 
00043 # if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \
00044              (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0)
00045 using std::tm;
00046 # if !defined (ACE_HAS_DINKUM_STL)
00047 #  if defined (ACE_WIN32)
00048 using std::_timezone;
00049 #  else
00050 using std::timezone;
00051 #  endif
00052 # endif
00053 using std::difftime;
00054 # endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */
00055 
00056 # if !defined (ACE_HAS_POSIX_TIME)
00057 // Definition per POSIX.
00058 typedef struct timespec
00059 {
00060   /// Seconds
00061   time_t tv_sec;
00062   /// Nanoseconds
00063   long tv_nsec;
00064 } timespec_t;
00065 # elif defined (ACE_HAS_BROKEN_POSIX_TIME)
00066 #  if defined (ACE_OPENVMS)
00067 #     include /**/ <timers.h>
00068 #  else
00069 // OSF/1 defines struct timespec in <sys/timers.h> - Tom Marrs
00070 #     include /**/ <sys/timers.h>
00071 #  endif
00072 # endif /* !ACE_HAS_POSIX_TIME */
00073 
00074 # if defined(ACE_LACKS_TIMESPEC_T)
00075 typedef struct timespec timespec_t;
00076 # endif /* ACE_LACKS_TIMESPEC_T */
00077 
00078 // Place all additions (especially function declarations) within extern "C" {}
00079 #ifdef __cplusplus
00080 extern "C"
00081 {
00082 #endif /* __cplusplus */
00083 
00084 #if defined (ACE_HAS_BROKEN_CTIME)
00085 #  undef ctime
00086 #endif /* ACE_HAS_BROKEN_CTIME */
00087 
00088 // There are a lot of threads-related macro definitions in the config files.
00089 // They came in at different times and from different places and platform
00090 // requirements as threads evolved.  They are probably not all needed - some
00091 // overlap or are otherwise confused.  This is an attempt to start
00092 // straightening them out.
00093 #if defined (ACE_HAS_PTHREADS_STD)    /* POSIX.1c threads (pthreads) */
00094    // ... and 2-parameter asctime_r and ctime_r
00095 #  if !defined (ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R) && \
00096       !defined (ACE_HAS_STHREADS) && !defined (ACE_VXWORKS)
00097 #    define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R
00098 #  endif
00099 #endif /* ACE_HAS_PTHREADS_STD */
00100 
00101 #if defined (ACE_LACKS_STRPTIME_PROTOTYPE) && !defined (_XOPEN_SOURCE)
00102    extern char *strptime (const char *s, const char *fmt, struct tm *tp);
00103 #endif  /* ACE_LACKS_STRPTIME_PROTOTYPE */
00104 
00105 #if defined (ACE_LACKS_CONST_TIMESPEC_PTR)
00106 typedef struct timespec * ACE_TIMESPEC_PTR;
00107 #else
00108 typedef const struct timespec * ACE_TIMESPEC_PTR;
00109 #endif /* ACE_LACKS_CONST_TIMESPEC_PTR */
00110 
00111 #if defined (DIGITAL_UNIX)
00112   extern char *_Pctime_r (const time_t *, char *);
00113   extern struct tm *_Plocaltime_r (const time_t *, struct tm *);
00114   extern struct tm *_Pgmtime_r (const time_t *, struct tm *);
00115   extern char *_Pasctime_r (const struct tm *, char *);
00116 #endif /* DIGITAL_UNIX */
00117 
00118 #ifdef __cplusplus
00119 }
00120 #endif /* __cplusplus */
00121 
00122 #include /**/ "ace/post.h"
00123 #endif /* ACE_OS_INCLUDE_OS_TIME_H */

Generated on Thu Nov 9 09:41:58 2006 for ACE by doxygen 1.3.6