Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/time.hfa

    r73abe95 r461eed2  
    1010// Created On       : Wed Mar 14 23:18:57 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jul  2 21:28:38 2018
    13 // Update Count     : 641
     12// Last Modified On : Sat Sep 22 12:25:34 2018
     13// Update Count     : 643
    1414//
    1515
     
    2323#include <sys/time.h>                                                                   // timeval
    2424}
    25 #include <time_t.hfa>                                                                           // Duration/Time types
     25#include <time_t.hfa>                                                                   // Duration/Time types
    2626
    2727enum { TIMEGRAN = 1_000_000_000LL };                                    // nanosecond granularity, except for timeval
     
    5252        Duration ?%=?( Duration & lhs, Duration rhs ) { lhs = lhs % rhs; return lhs; }
    5353
    54         _Bool ?==?( Duration lhs, Duration rhs ) { return lhs.tv == rhs.tv; }
    55         _Bool ?!=?( Duration lhs, Duration rhs ) { return lhs.tv != rhs.tv; }
    56         _Bool ?<? ( Duration lhs, Duration rhs ) { return lhs.tv <  rhs.tv; }
    57         _Bool ?<=?( Duration lhs, Duration rhs ) { return lhs.tv <= rhs.tv; }
    58         _Bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tv >  rhs.tv; }
    59         _Bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tv >= rhs.tv; }
    60 
    61         _Bool ?==?( Duration lhs, zero_t ) { return lhs.tv == 0; }
    62         _Bool ?!=?( Duration lhs, zero_t ) { return lhs.tv != 0; }
    63         _Bool ?<? ( Duration lhs, zero_t ) { return lhs.tv <  0; }
    64         _Bool ?<=?( Duration lhs, zero_t ) { return lhs.tv <= 0; }
    65         _Bool ?>? ( Duration lhs, zero_t ) { return lhs.tv >  0; }
    66         _Bool ?>=?( Duration lhs, zero_t ) { return lhs.tv >= 0; }
     54        bool ?==?( Duration lhs, Duration rhs ) { return lhs.tv == rhs.tv; }
     55        bool ?!=?( Duration lhs, Duration rhs ) { return lhs.tv != rhs.tv; }
     56        bool ?<? ( Duration lhs, Duration rhs ) { return lhs.tv <  rhs.tv; }
     57        bool ?<=?( Duration lhs, Duration rhs ) { return lhs.tv <= rhs.tv; }
     58        bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tv >  rhs.tv; }
     59        bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tv >= rhs.tv; }
     60
     61        bool ?==?( Duration lhs, zero_t ) { return lhs.tv == 0; }
     62        bool ?!=?( Duration lhs, zero_t ) { return lhs.tv != 0; }
     63        bool ?<? ( Duration lhs, zero_t ) { return lhs.tv <  0; }
     64        bool ?<=?( Duration lhs, zero_t ) { return lhs.tv <= 0; }
     65        bool ?>? ( Duration lhs, zero_t ) { return lhs.tv >  0; }
     66        bool ?>=?( Duration lhs, zero_t ) { return lhs.tv >= 0; }
    6767
    6868        Duration abs( Duration rhs ) { return rhs.tv >= 0 ? rhs : -rhs; }
     
    104104
    105105        timeval ?=?( timeval & t, zero_t ) { return t{ 0 }; }
    106         timeval ?+?( timeval & lhs, timeval rhs ) { return (timeval)@{ lhs.tv_sec + rhs.tv_sec, lhs.tv_usec + rhs.tv_usec }; }
    107         timeval ?-?( timeval & lhs, timeval rhs ) { return (timeval)@{ lhs.tv_sec - rhs.tv_sec, lhs.tv_usec - rhs.tv_usec }; }
    108         _Bool ?==?( timeval lhs, timeval rhs ) { return lhs.tv_sec == rhs.tv_sec && lhs.tv_usec == rhs.tv_usec; }
    109         _Bool ?!=?( timeval lhs, timeval rhs ) { return lhs.tv_sec != rhs.tv_sec || lhs.tv_usec != rhs.tv_usec; }
     106        timeval ?+?( timeval lhs, timeval rhs ) { return (timeval)@{ lhs.tv_sec + rhs.tv_sec, lhs.tv_usec + rhs.tv_usec }; }
     107        timeval ?-?( timeval lhs, timeval rhs ) { return (timeval)@{ lhs.tv_sec - rhs.tv_sec, lhs.tv_usec - rhs.tv_usec }; }
     108        bool ?==?( timeval lhs, timeval rhs ) { return lhs.tv_sec == rhs.tv_sec && lhs.tv_usec == rhs.tv_usec; }
     109        bool ?!=?( timeval lhs, timeval rhs ) { return lhs.tv_sec != rhs.tv_sec || lhs.tv_usec != rhs.tv_usec; }
    110110} // distribution
    111111
     
    119119
    120120        timespec ?=?( timespec & t, zero_t ) { return t{ 0 }; }
    121         timespec ?+?( timespec & lhs, timespec rhs ) { return (timespec)@{ lhs.tv_sec + rhs.tv_sec, lhs.tv_nsec + rhs.tv_nsec }; }
    122         timespec ?-?( timespec & lhs, timespec rhs ) { return (timespec)@{ lhs.tv_sec - rhs.tv_sec, lhs.tv_nsec - rhs.tv_nsec }; }
    123         _Bool ?==?( timespec lhs, timespec rhs ) { return lhs.tv_sec == rhs.tv_sec && lhs.tv_nsec == rhs.tv_nsec; }
    124         _Bool ?!=?( timespec lhs, timespec rhs ) { return lhs.tv_sec != rhs.tv_sec || lhs.tv_nsec != rhs.tv_nsec; }
     121        timespec ?+?( timespec lhs, timespec rhs ) { return (timespec)@{ lhs.tv_sec + rhs.tv_sec, lhs.tv_nsec + rhs.tv_nsec }; }
     122        timespec ?-?( timespec lhs, timespec rhs ) { return (timespec)@{ lhs.tv_sec - rhs.tv_sec, lhs.tv_nsec - rhs.tv_nsec }; }
     123        bool ?==?( timespec lhs, timespec rhs ) { return lhs.tv_sec == rhs.tv_sec && lhs.tv_nsec == rhs.tv_nsec; }
     124        bool ?!=?( timespec lhs, timespec rhs ) { return lhs.tv_sec != rhs.tv_sec || lhs.tv_nsec != rhs.tv_nsec; }
    125125} // distribution
    126126
     
    166166        Time ?-?( Time lhs, Duration rhs ) { return (Time)@{ lhs.tv - rhs.tv }; }
    167167        Time ?-=?( Time & lhs, Duration rhs ) { lhs = lhs - rhs; return lhs; }
    168         _Bool ?==?( Time lhs, Time rhs ) { return lhs.tv == rhs.tv; }
    169         _Bool ?!=?( Time lhs, Time rhs ) { return lhs.tv != rhs.tv; }
    170         _Bool ?<?( Time lhs, Time rhs ) { return lhs.tv < rhs.tv; }
    171         _Bool ?<=?( Time lhs, Time rhs ) { return lhs.tv <= rhs.tv; }
    172         _Bool ?>?( Time lhs, Time rhs ) { return lhs.tv > rhs.tv; }
    173         _Bool ?>=?( Time lhs, Time rhs ) { return lhs.tv >= rhs.tv; }
     168        bool ?==?( Time lhs, Time rhs ) { return lhs.tv == rhs.tv; }
     169        bool ?!=?( Time lhs, Time rhs ) { return lhs.tv != rhs.tv; }
     170        bool ?<?( Time lhs, Time rhs ) { return lhs.tv < rhs.tv; }
     171        bool ?<=?( Time lhs, Time rhs ) { return lhs.tv <= rhs.tv; }
     172        bool ?>?( Time lhs, Time rhs ) { return lhs.tv > rhs.tv; }
     173        bool ?>=?( Time lhs, Time rhs ) { return lhs.tv >= rhs.tv; }
    174174} // distribution
    175175
Note: See TracChangeset for help on using the changeset viewer.