Changeset 6f6b844


Ignore:
Timestamp:
Apr 20, 2021, 11:28:42 PM (8 weeks ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
arm-eh, jacob/cs343-translation, master
Children:
dabc428
Parents:
6c5d92f
Message:

formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/time.hfa

    r6c5d92f r6f6b844  
    1010// Created On       : Wed Mar 14 23:18:57 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Apr 14 09:30:30 2021
    13 // Update Count     : 664
     12// Last Modified On : Tue Apr 20 23:25:58 2021
     13// Update Count     : 665
    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
    3033        Duration ?=?( Duration & dur, __attribute__((unused)) zero_t ) { return dur{ 0 }; }
    31 
    32         void ?{}( Duration & dur, timeval t ) with( dur ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; }
    3334        Duration ?=?( Duration & dur, timeval t ) with( dur ) {
    3435                tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL);
    3536                return dur;
    3637        } // ?=?
    37 
    38         void ?{}( Duration & dur, timespec t ) with( dur ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; }
    3938        Duration ?=?( Duration & dur, timespec t ) with( dur ) {
    4039                tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec;
     
    6160        Duration ?%?( Duration lhs, Duration rhs ) { return (Duration)@{ lhs.tn % rhs.tn }; }
    6261        Duration ?%=?( Duration & lhs, Duration rhs ) { lhs = lhs % rhs; return lhs; }
     62
     63        bool ?==?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn == 0; }
     64        bool ?!=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn != 0; }
     65        bool ?<? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn <  0; }
     66        bool ?<=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn <= 0; }
     67        bool ?>? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn >  0; }
     68        bool ?>=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn >= 0; }
    6369
    6470        bool ?==?( Duration lhs, Duration rhs ) { return lhs.tn == rhs.tn; }
     
    6874        bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tn >  rhs.tn; }
    6975        bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tn >= rhs.tn; }
    70 
    71         bool ?==?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn == 0; }
    72         bool ?!=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn != 0; }
    73         bool ?<? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn <  0; }
    74         bool ?<=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn <= 0; }
    75         bool ?>? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn >  0; }
    76         bool ?>=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn >= 0; }
    7776
    7877        Duration abs( Duration rhs ) { return rhs.tn >= 0 ? rhs : -rhs; }
     
    118117static inline {
    119118        void ?{}( timeval & t ) {}
     119        void ?{}( timeval & t, __attribute__((unused)) zero_t ) { t{ 0, 0 }; }
    120120        void ?{}( timeval & t, time_t sec, suseconds_t usec ) { t.tv_sec = sec; t.tv_usec = usec; }
    121121        void ?{}( timeval & t, time_t sec ) { t{ sec, 0 }; }
    122         void ?{}( timeval & t, __attribute__((unused)) zero_t ) { t{ 0, 0 }; }
    123122
    124123        timeval ?=?( timeval & t, __attribute__((unused)) zero_t ) { return t{ 0 }; }
     
    133132static inline {
    134133        void ?{}( timespec & t ) {}
     134        void ?{}( timespec & t, __attribute__((unused)) zero_t ) { t{ 0, 0 }; }
    135135        void ?{}( timespec & t, time_t sec, __syscall_slong_t nsec ) { t.tv_sec = sec; t.tv_nsec = nsec; }
    136136        void ?{}( timespec & t, time_t sec ) { t{ sec, 0}; }
    137         void ?{}( timespec & t, __attribute__((unused)) zero_t ) { t{ 0, 0 }; }
    138137
    139138        timespec ?=?( timespec & t, __attribute__((unused)) zero_t ) { return t{ 0 }; }
     
    164163void ?{}( Time & time, int year, int month = 1, int day = 1, int hour = 0, int min = 0, int sec = 0, int64_t nsec = 0 );
    165164static inline {
     165        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
    166168        Time ?=?( Time & time, __attribute__((unused)) zero_t ) { return time{ 0 }; }
    167 
    168         void ?{}( Time & time, timeval t ) with( time ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; }
    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; }
    175173        Time ?=?( Time & time, timespec t ) with( time ) {
    176174                tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec;
Note: See TracChangeset for help on using the changeset viewer.