Changeset 0f56058 for src/libcfa/time


Ignore:
Timestamp:
Apr 10, 2018, 5:50:27 PM (8 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:
2ae8507a
Parents:
8ad6533
Message:

divide "time" into type and functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/time

    r8ad6533 r0f56058  
    1010// Created On       : Wed Mar 14 23:18:57 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Apr  9 13:10:23 2018
    13 // Update Count     : 616
     12// Last Modified On : Tue Apr 10 17:25:34 2018
     13// Update Count     : 622
    1414//
    1515
     
    2727enum { TIMEGRAN = 1_000_000_000LL };                                    // nanosecond granularity, except for timeval
    2828
     29#include <time_t.h>                                                                             // Duration (constructors) / Time (constructors)
    2930
    3031//######################### Duration #########################
    3132
    32 struct Duration {                                                                               // private
    33         int64_t tv;                                                                                     // nanoseconds
    34 }; // Duration
    35 
    36 static inline void ?{}( Duration & dur ) with( dur ) { tv = 0; }
    37 static inline void ?{}( Duration & dur, Duration d ) with( dur ) { tv = d.tv; }
    38 
    39 static inline void ?{}( Duration & dur, zero_t ) with( dur ) { tv = 0; }
    4033static inline Duration ?=?( Duration & dur, zero_t ) { return dur{ 0 }; }
    4134
     
    155148//######################### Time #########################
    156149
    157 struct Time {                                                                                   // private
    158         uint64_t tv;                                                                            // nanoseconds since UNIX epoch
    159 }; // Time
    160 
    161 static inline void ?{}( Time & t ) with( t ) { tv = 0; } // fast
    162 void ?{}( Time & time, int year, int month = 0, int day = 0, int hour = 0, int min = 0, int sec = 0, int nsec = 0 ); // slow
    163 
    164 static inline void ?{}( Time & t, zero_t ) { t.tv = 0; }
    165150static inline Time ?=?( Time & t, zero_t ) { return t{ 0 }; }
    166151
     
    247232} // resetClock
    248233
    249 static inline void ?{}( Clock & clk ) {
    250         resetClock( clk );
    251 } // Clock
    252 
    253 static inline void ?{}( Clock & clk, Duration adj ) {
    254         resetClock( clk, adj );
    255 } // Clock
     234static inline void ?{}( Clock & clk ) { resetClock( clk ); }
     235static inline void ?{}( Clock & clk, Duration adj ) { resetClock( clk, adj ); }
    256236
    257237static inline Duration getRes() {
Note: See TracChangeset for help on using the changeset viewer.