Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 510

Show
Ignore:
Timestamp:
01/15/11 05:55:12 (14 years ago)
Author:
sean
Message:

Moved CLOCK_MONOTONIC to the correct spot.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/core/sys/posix/time.d

    r490 r510  
    7272int clock_nanosleep(clockid_t, int, in timespec*, timespec*); 
    7373*/ 
    7474 
    7575// 
    7676// Monotonic Clock (MON) 
    7777// 
    7878/* 
    7979CLOCK_MONOTONIC 
    8080*/ 
    8181 
     82version( linux ) 
     83{ 
     84    enum CLOCK_MONOTONIC        = 1; 
     85    enum CLOCK_MONOTONIC_RAW    = 4; // non-standard 
     86    enum CLOCK_MONOTONIC_COARSE = 6; // non-standard 
     87     
     88} 
     89 
    8290// 
    8391// Timer (TMR) 
    8492// 
    8593/* 
    8694CLOCK_PROCESS_CPUTIME_ID (TMR|CPT) 
    8795CLOCK_THREAD_CPUTIME_ID (TMR|TCT) 
    8896 
    8997NOTE: timespec must be defined in core.sys.posix.signal to break 
    9098      a circular import. 
    9199 
     
    113121int nanosleep(in timespec*, timespec*); 
    114122int timer_create(clockid_t, sigevent*, timer_t*); 
    115123int timer_delete(timer_t); 
    116124int timer_gettime(timer_t, itimerspec*); 
    117125int timer_getoverrun(timer_t); 
    118126int timer_settime(timer_t, int, in itimerspec*, itimerspec*); 
    119127*/ 
    120128 
    121129version( linux ) 
    122130{ 
     131    enum CLOCK_PROCESS_CPUTIME_ID = 2; 
     132    enum CLOCK_THREAD_CPUTIME_ID  = 3; 
     133 
    123134    // NOTE: See above for why this is commented out. 
    124135    // 
    125136    //struct timespec 
    126137    //{ 
    127138    //    time_t  tv_sec; 
    128139    //    c_long  tv_nsec; 
    129140    //} 
    130141 
    131142    struct itimerspec 
    132143    { 
    133144        timespec it_interval; 
    134145        timespec it_value; 
    135146    } 
    136147 
    137     enum CLOCK_REALTIME           = 0; // Identifier for system-wide realtime clock. 
    138     enum CLOCK_MONOTONIC          = 1; // Monotonic system-wide clock. 
    139     enum CLOCK_PROCESS_CPUTIME_ID = 2; // High-resolution timer from the CPU. 
    140     enum CLOCK_THREAD_CPUTIME_ID  = 3; // Thread-specific CPU-time clock. 
    141     enum CLOCK_MONOTONIC_RAW      = 4; // Monotonic system-wide clock, not adjusted for frequency scaling. 
    142     enum CLOCK_REALTIME_COARSE    = 5; // Identifier for system-wide realtime clock, updated only on ticks. 
    143     enum CLOCK_MONOTONIC_COARSE   = 6; // Monotonic system-wide clock, updated only on ticks. 
    144  
    145     enum TIMER_ABSTIME = 0x01; 
     148    enum CLOCK_REALTIME         = 0; 
     149    enum CLOCK_REALTIME_COARSE  = 5; // non-standard 
     150    enum TIMER_ABSTIME          = 0x01; 
    146151 
    147152    alias int clockid_t; 
    148153    alias int timer_t; 
    149154 
    150155    int clock_getres(clockid_t, timespec*); 
    151156    int clock_gettime(clockid_t, timespec*); 
    152157    int clock_settime(clockid_t, in timespec*); 
    153158    int nanosleep(in timespec*, timespec*); 
    154159    int timer_create(clockid_t, sigevent*, timer_t*); 
    155160    int timer_delete(timer_t); 
    156161    int timer_gettime(timer_t, itimerspec*); 
    157162    int timer_getoverrun(timer_t); 
    158163    int timer_settime(timer_t, int, in itimerspec*, itimerspec*); 
    159164} 
    160165else version( OSX ) 
    161166{ 
    162167    int nanosleep(in timespec*, timespec*); 
    163168} 
    164169else version( FreeBSD ) 
    165170{ 
    166     enum CLOCK_THREAD_CPUTIME_ID    = 15; 
     171    //enum CLOCK_PROCESS_CPUTIME_ID = ??; 
     172    enum CLOCK_THREAD_CPUTIME_ID  = 15; 
    167173 
    168174    // NOTE: See above for why this is commented out. 
    169175    // 
    170176    //struct timespec 
    171177    //{ 
    172178    //    time_t  tv_sec; 
    173179    //    c_long  tv_nsec; 
    174180    //} 
    175181 
    176182    struct itimerspec