Back to index

php5  5.3.10
Classes | Defines | Functions
time.h File Reference
#include <time.h>
#include "php.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  timezone
struct  itimerval
struct  timespec

Defines

#define ITIMER_REAL   0 /*generates sigalrm */
#define ITIMER_VIRTUAL   1 /*generates sigvtalrm */
#define ITIMER_VIRT   1 /*generates sigvtalrm */
#define ITIMER_PROF   2 /*generates sigprof */

Functions

PHPAPI int gettimeofday (struct timeval *time_Info, struct timezone *timezone_Info)
PHPAPI int setitimer (int which, const struct itimerval *value, struct itimerval *ovalue)
PHPAPI int nanosleep (const struct timespec *rqtp, struct timespec *rmtp)

Class Documentation

struct timezone

Definition at line 20 of file time.h.

Class Members
int tz_dsttime
int tz_minuteswest
struct itimerval

Definition at line 26 of file time.h.

struct timespec

Definition at line 32 of file time.h.

Class Members
long tv_nsec
time_t tv_sec

Define Documentation

#define ITIMER_PROF   2 /*generates sigprof */

Definition at line 42 of file time.h.

#define ITIMER_REAL   0 /*generates sigalrm */

Definition at line 39 of file time.h.

#define ITIMER_VIRT   1 /*generates sigvtalrm */

Definition at line 41 of file time.h.

#define ITIMER_VIRTUAL   1 /*generates sigvtalrm */

Definition at line 40 of file time.h.


Function Documentation

PHPAPI int gettimeofday ( struct timeval *  time_Info,
struct timezone timezone_Info 
)

Definition at line 51 of file time.c.

{
       __int64 timer;
       LARGE_INTEGER li;
       BOOL b;
       double dt;
       TSRMLS_FETCH();

       /* Get the time, if they want it */
       if (time_Info != NULL) {
              if (PW32G(starttime).tv_sec == 0) {
            b = QueryPerformanceFrequency(&li);
            if (!b) {
                PW32G(starttime).tv_sec = -1;
            }
            else {
                PW32G(freq) = li.QuadPart;
                b = QueryPerformanceCounter(&li);
                if (!b) {
                    PW32G(starttime).tv_sec = -1;
                }
                else {
                    getfilesystemtime(&PW32G(starttime));
                    timer = li.QuadPart;
                    dt = (double)timer/PW32G(freq);
                    PW32G(starttime).tv_usec -= (int)((dt-(int)dt)*1000000);
                    if (PW32G(starttime).tv_usec < 0) {
                        PW32G(starttime).tv_usec += 1000000;
                        --PW32G(starttime).tv_sec;
                    }
                    PW32G(starttime).tv_sec -= (int)dt;
                }
            }
        }
        if (PW32G(starttime).tv_sec > 0) {
            b = QueryPerformanceCounter(&li);
            if (!b) {
                PW32G(starttime).tv_sec = -1;
            }
            else {
                timer = li.QuadPart;
                if (timer < PW32G(lasttime)) {
                    getfilesystemtime(time_Info);
                    dt = (double)timer/PW32G(freq);
                    PW32G(starttime) = *time_Info;
                    PW32G(starttime).tv_usec -= (int)((dt-(int)dt)*1000000);
                    if (PW32G(starttime).tv_usec < 0) {
                        PW32G(starttime).tv_usec += 1000000;
                        --PW32G(starttime).tv_sec;
                    }
                    PW32G(starttime).tv_sec -= (int)dt;
                }
                else {
                    PW32G(lasttime) = timer;
                    dt = (double)timer/PW32G(freq);
                    time_Info->tv_sec = PW32G(starttime).tv_sec + (int)dt;
                    time_Info->tv_usec = PW32G(starttime).tv_usec + (int)((dt-(int)dt)*1000000);
                    if (time_Info->tv_usec >= 1000000) {
                        time_Info->tv_usec -= 1000000;
                        ++time_Info->tv_sec;
                    }
                }
            }
        }
        if (PW32G(starttime).tv_sec < 0) {
            getfilesystemtime(time_Info);
        }

       }
       /* Get the timezone, if they want it */
       if (timezone_Info != NULL) {
              _tzset();
              timezone_Info->tz_minuteswest = _timezone;
              timezone_Info->tz_dsttime = _daylight;
       }
       /* And return */
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PHPAPI int nanosleep ( const struct timespec rqtp,
struct timespec rmtp 
)

Definition at line 144 of file time.c.

{
       if (rqtp->tv_nsec > 999999999) {
              /* The time interval specified 1,000,000 or more microseconds. */
              errno = EINVAL;
              return -1;
       }
       return usleep( rqtp->tv_sec * 1000000 + rqtp->tv_nsec / 1000  );
}

Here is the call graph for this function:

Here is the caller graph for this function:

PHPAPI int setitimer ( int  which,
const struct itimerval value,
struct itimerval ovalue 
)

Here is the caller graph for this function: