summaryrefslogtreecommitdiff
path: root/pthread.h
diff options
context:
space:
mode:
authorrpj <rpj>2007-11-22 14:14:57 +0000
committerrpj <rpj>2007-11-22 14:14:57 +0000
commit25ffdcfc06e8a84497fd7e80aa4cef111d7dad2d (patch)
treee1a03422251b1556d6770458edf71a5475f7cf36 /pthread.h
parentb1dc8324d03053ffb427424c8de046863757d8ec (diff)
''
Diffstat (limited to 'pthread.h')
-rw-r--r--pthread.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/pthread.h b/pthread.h
index 9026111..db05327 100644
--- a/pthread.h
+++ b/pthread.h
@@ -305,7 +305,7 @@ enum {
#ifndef HAVE_STRUCT_TIMESPEC
#define HAVE_STRUCT_TIMESPEC 1
struct timespec {
- long tv_sec;
+ time_t tv_sec;
long tv_nsec;
};
#endif /* HAVE_STRUCT_TIMESPEC */
@@ -1249,13 +1249,19 @@ PTW32_DLLPORT int PTW32_CDECL pthreadCancelableTimedWait (HANDLE waitHandle,
( strcpy( (_buf), ctime( (_clock) ) ), \
(_buf) )
+/*
+ * gmtime(tm) and localtime(tm) return 0 if tm represents
+ * a time prior to 1/1/1970.
+ */
#define gmtime_r( _clock, _result ) \
- ( *(_result) = *gmtime( (_clock) ), \
- (_result) )
+ ( gmtime( (_clock) ) \
+ ? (*(_result) = *gmtime( (_clock) ), (_result) ) \
+ : (0) )
#define localtime_r( _clock, _result ) \
- ( *(_result) = *localtime( (_clock) ), \
- (_result) )
+ ( localtime( (_clock) ) \
+ ? (*(_result) = *localtime( (_clock) ), (_result) ) \
+ : (0) )
#define rand_r( _seed ) \
( _seed == _seed? rand() : rand() )