Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/time.hfa

    re638266 r030653a  
    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 Jun 17 16:13:00 2020
     13// Update Count     : 663
    1414//
    1515
     
    2828
    2929static inline {
    30         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 
    3330        Duration ?=?( Duration & dur, __attribute__((unused)) zero_t ) { return dur{ 0 }; }
    34         Duration ?=?( Duration & dur, timeval t ) with( dur ) {
    35                 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL);
    36                 return dur;
    37         } // ?=?
    38         Duration ?=?( Duration & dur, timespec t ) with( dur ) {
    39                 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec;
    40                 return dur;
    41         } // ?=?
    4231
    4332        Duration +?( Duration rhs ) with( rhs ) { return (Duration)@{ +tn }; }
     
    6049        Duration ?%?( Duration lhs, Duration rhs ) { return (Duration)@{ lhs.tn % rhs.tn }; }
    6150        Duration ?%=?( Duration & lhs, Duration rhs ) { lhs = lhs % rhs; return lhs; }
     51
     52        bool ?==?( Duration lhs, Duration rhs ) { return lhs.tn == rhs.tn; }
     53        bool ?!=?( Duration lhs, Duration rhs ) { return lhs.tn != rhs.tn; }
     54        bool ?<? ( Duration lhs, Duration rhs ) { return lhs.tn <  rhs.tn; }
     55        bool ?<=?( Duration lhs, Duration rhs ) { return lhs.tn <= rhs.tn; }
     56        bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tn >  rhs.tn; }
     57        bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tn >= rhs.tn; }
    6258
    6359        bool ?==?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn == 0; }
     
    6763        bool ?>? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn >  0; }
    6864        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; }
    7665
    7766        Duration abs( Duration rhs ) { return rhs.tn >= 0 ? rhs : -rhs; }
     
    163152void ?{}( Time & time, int year, int month = 1, int day = 1, int hour = 0, int min = 0, int sec = 0, int64_t nsec = 0 );
    164153static inline {
     154        Time ?=?( Time & time, __attribute__((unused)) zero_t ) { return time{ 0 }; }
     155
    165156        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 }; }
    169157        Time ?=?( Time & time, timeval t ) with( time ) {
    170158                tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL);
    171159                return time;
    172160        } // ?=?
     161
     162        void ?{}( Time & time, timespec t ) with( time ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; }
    173163        Time ?=?( Time & time, timespec t ) with( time ) {
    174164                tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec;
Note: See TracChangeset for help on using the changeset viewer.