Mobile API Reference  MicroStrategy 2019
PDCtime.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : PDCtime.h
3 // AUTHOR : Perl Script
4 // CREATION : 6/13/02
5 // Copyright (C) MicroStrategy, Inc. 2002
6 //==============================================================================================
7 #ifndef PDCtime_h
8 #define PDCtime_h
9 
10 // this must be the *first* file included
11 #include "ProtectedSource/Prolog.h"
12 
13 #ifdef WIN32
14  #include <time.h>
15 #else
16  #include <time.h>
17  #include <sys/time.h>
18 #endif // WIN32
19 
20 #ifndef WIN32
21 #include "PDCerrno.h"
22 
23 namespace MPDCHeader
24 {
25  // a signal-safe wrapper
26  inline int nanosleep(const struct timespec* rqtp)
27  {
28  struct timespec lSleepTime = *rqtp;
29  struct timespec lRemainder;
30 
31  for (;;)
32  {
33  const int lResult = ::nanosleep(&lSleepTime, &lRemainder);
34 
35  if (lResult == -1)
36  {
37  if (errno == EINTR)
38  {
39  // interrupted by signal, retry
40  lSleepTime = lRemainder;
41  continue;
42  }
43 
44  // error
45  return -1;
46  }
47 
48  return lResult;
49  }
50  }
51 }
52 
53 #endif // WIN32
54 
55 // this must be the *last* file included
56 #include "ProtectedSource/Epilog.h"
57 
58 #endif // PDCtime_h
int nanosleep(const struct timespec *rqtp)
Definition: PDCtime.h:26
Definition: PDCtime.h:23