Changeset 9f652a1


Ignore:
Timestamp:
Apr 3, 2018, 9:19:21 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
bb37870
Parents:
8eb2018
Message:

formatting and add ?%=? for duration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/time

    r8eb2018 r9f652a1  
    1010// Created On       : Wed Mar 14 23:18:57 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr  1 20:03:16 2018
    13 // Update Count     : 581
     12// Last Modified On : Tue Apr  3 08:46:08 2018
     13// Update Count     : 585
    1414//
    1515
     
    113113
    114114static inline Duration ?%?( Duration lhs, Duration rhs ) { return (Duration)@{ lhs.tv % rhs.tv }; }
     115static inline Duration ?%=?( Duration & lhs, Duration rhs ) { lhs = lhs % rhs; return lhs; }
    115116
    116117static inline _Bool ?==?( Duration lhs, Duration rhs ) { return lhs.tv == rhs.tv; }
     
    139140static inline Duration ?`m ( int64_t min   ) { return (Duration)@{ min * (60LL * TIMEGRAN) }; }
    140141static inline Duration ?`m ( double  min   ) { return (Duration)@{ min * (60LL * TIMEGRAN) }; }
    141 static inline Duration ?`h ( int64_t hours ) { return (Duration)@{ hours * (3600LL * TIMEGRAN) }; }
    142 static inline Duration ?`h ( double  hours ) { return (Duration)@{ hours * (3600LL * TIMEGRAN) }; }
    143 static inline Duration ?`d ( int64_t days  ) { return (Duration)@{ days * (24LL * 3600LL * TIMEGRAN) }; }
    144 static inline Duration ?`d ( double  days  ) { return (Duration)@{ days * (24LL * 3600LL * TIMEGRAN) }; }
    145 static inline Duration ?`w ( int64_t weeks ) { return (Duration)@{ weeks * (7LL * 24LL * 3600LL * TIMEGRAN) }; }
    146 //static inline Duration ?`f ( int64_t fortnight ) { return (Duration)@{ fortnight * (14LL * 24LL * 3600LL * TIMEGRAN) }; }
     142static inline Duration ?`h ( int64_t hours ) { return (Duration)@{ hours * (60LL * 60LL * TIMEGRAN) }; }
     143static inline Duration ?`h ( double  hours ) { return (Duration)@{ hours * (60LL * 60LL * TIMEGRAN) }; }
     144static inline Duration ?`d ( int64_t days  ) { return (Duration)@{ days * (24LL * 60LL * 60LL * TIMEGRAN) }; }
     145static inline Duration ?`d ( double  days  ) { return (Duration)@{ days * (24LL * 60LL * 60LL * TIMEGRAN) }; }
     146static inline Duration ?`w ( int64_t weeks ) { return (Duration)@{ weeks * (7LL * 24LL * 60LL * 60LL * TIMEGRAN) }; }
     147static inline Duration ?`w ( double  weeks ) { return (Duration)@{ weeks * (7LL * 24LL * 60LL * 60LL * TIMEGRAN) }; }
     148//static inline Duration ?`f ( int64_t fortnight ) { return (Duration)@{ fortnight * (14LL * 24LL * 60LL * 60LL * TIMEGRAN) }; }
     149//static inline Duration ?`f ( double  fortnight ) { return (Duration)@{ fortnight * (14LL * 24LL * 60LL * 60LL * TIMEGRAN) }; }
    147150
    148151static inline int64_t ?`ns ( Duration dur ) { return dur.tv; }
     
    151154static inline int64_t ?`s  ( Duration dur ) { return dur.tv / TIMEGRAN; }
    152155static inline int64_t ?`m  ( Duration dur ) { return dur.tv / (60LL * TIMEGRAN); }
    153 static inline int64_t ?`h  ( Duration dur ) { return dur.tv / (3600LL * TIMEGRAN); }
    154 static inline int64_t ?`d  ( Duration dur ) { return dur.tv / (24LL * 3600LL * TIMEGRAN); }
    155 static inline int64_t ?`w  ( Duration dur ) { return dur.tv / (7LL * 24LL * 3600LL * TIMEGRAN); }
    156 static inline int64_t ?`f  ( Duration dur ) { return dur.tv / (14LL * 24LL * 3600LL * TIMEGRAN); }
     156static inline int64_t ?`h  ( Duration dur ) { return dur.tv / (60LL * 60LL * TIMEGRAN); }
     157static inline int64_t ?`d  ( Duration dur ) { return dur.tv / (24LL * 60LL * 60LL * TIMEGRAN); }
     158static inline int64_t ?`w  ( Duration dur ) { return dur.tv / (7LL * 24LL * 60LL * 60LL * TIMEGRAN); }
     159static inline int64_t ?`f  ( Duration dur ) { return dur.tv / (14LL * 24LL * 60LL * 60LL * TIMEGRAN); }
    157160
    158161//------------------------- timeval (cont) -------------------------
Note: See TracChangeset for help on using the changeset viewer.