Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/time.hfa

    re638266 r89c2a77b  
    1010// Created On       : Wed Mar 14 23:18:57 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Apr 21 06:32:31 2021
    13 // Update Count     : 667
     12// Last Modified On : Wed Apr 14 09:30:30 2021
     13// Update Count     : 664
    1414//
    1515
     
    2828
    2929static inline {
     30        Duration ?=?( Duration & dur, __attribute__((unused)) zero_t ) { return dur{ 0 }; }
     31
    3032        void ?{}( Duration & dur, timeval t ) with( dur ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; }
    31         void ?{}( Duration & dur, timespec t ) with( dur ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; }
    32 
    33         Duration ?=?( Duration & dur, __attribute__((unused)) zero_t ) { return dur{ 0 }; }
    3433        Duration ?=?( Duration & dur, timeval t ) with( dur ) {
    3534                tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL);
    3635                return dur;
    3736        } // ?=?
     37
     38        void ?{}( Duration & dur, timespec t ) with( dur ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; }
    3839        Duration ?=?( Duration & dur, timespec t ) with( dur ) {
    3940                tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec;
     
    6061        Duration ?%?( Duration lhs, Duration rhs ) { return (Duration)@{ lhs.tn % rhs.tn }; }
    6162        Duration ?%=?( Duration & lhs, Duration rhs ) { lhs = lhs % rhs; return lhs; }
     63
     64        bool ?==?( Duration lhs, Duration rhs ) { return lhs.tn == rhs.tn; }
     65        bool ?!=?( Duration lhs, Duration rhs ) { return lhs.tn != rhs.tn; }
     66        bool ?<? ( Duration lhs, Duration rhs ) { return lhs.tn <  rhs.tn; }
     67        bool ?<=?( Duration lhs, Duration rhs ) { return lhs.tn <= rhs.tn; }
     68        bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tn >  rhs.tn; }
     69        bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tn >= rhs.tn; }
    6270
    6371        bool ?==?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn == 0; }
     
    6775        bool ?>? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn >  0; }
    6876        bool ?>=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn >= 0; }
    69 
    70         bool ?==?( Duration lhs, Duration rhs ) { return lhs.tn == rhs.tn; }
    71         bool ?!=?( Duration lhs, Duration rhs ) { return lhs.tn != rhs.tn; }
    72         bool ?<? ( Duration lhs, Duration rhs ) { return lhs.tn <  rhs.tn; }
    73         bool ?<=?( Duration lhs, Duration rhs ) { return lhs.tn <= rhs.tn; }
    74         bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tn >  rhs.tn; }
    75         bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tn >= rhs.tn; }
    7677
    7778        Duration abs( Duration rhs ) { return rhs.tn >= 0 ? rhs : -rhs; }
     
    163164void ?{}( Time & time, int year, int month = 1, int day = 1, int hour = 0, int min = 0, int sec = 0, int64_t nsec = 0 );
    164165static inline {
     166        Time ?=?( Time & time, __attribute__((unused)) zero_t ) { return time{ 0 }; }
     167
    165168        void ?{}( Time & time, timeval t ) with( time ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; }
    166         void ?{}( Time & time, timespec t ) with( time ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; }
    167 
    168         Time ?=?( Time & time, __attribute__((unused)) zero_t ) { return time{ 0 }; }
    169169        Time ?=?( Time & time, timeval t ) with( time ) {
    170170                tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL);
    171171                return time;
    172172        } // ?=?
     173
     174        void ?{}( Time & time, timespec t ) with( time ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; }
    173175        Time ?=?( Time & time, timespec t ) with( time ) {
    174176                tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec;
Note: See TracChangeset for help on using the changeset viewer.