ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
deferred_resn
demangler
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
with_gc
Last change
on this file since 2ae8507a was 0f56058, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago |
divide "time" into type and functions
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[0f56058] | 1 | //
|
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
|
---|
| 3 | //
|
---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
---|
| 5 | // file "LICENCE" distributed with Cforall.
|
---|
| 6 | //
|
---|
| 7 | // time_t.h --
|
---|
| 8 | //
|
---|
| 9 | // Author : Peter A. Buhr
|
---|
| 10 | // Created On : Tue Apr 10 14:42:03 2018
|
---|
| 11 | // Last Modified By : Peter A. Buhr
|
---|
| 12 | // Last Modified On : Tue Apr 10 16:32:04 2018
|
---|
| 13 | // Update Count : 3
|
---|
| 14 | //
|
---|
| 15 |
|
---|
| 16 | #pragma once
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 | //######################### Duration #########################
|
---|
| 20 |
|
---|
| 21 | struct Duration { // private
|
---|
| 22 | int64_t tv; // nanoseconds
|
---|
| 23 | }; // Duration
|
---|
| 24 |
|
---|
| 25 | static inline void ?{}( Duration & dur ) with( dur ) { tv = 0; }
|
---|
| 26 | static inline void ?{}( Duration & dur, Duration d ) with( dur ) { tv = d.tv; }
|
---|
| 27 | static inline void ?{}( Duration & dur, zero_t ) with( dur ) { tv = 0; }
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | //######################### Time #########################
|
---|
| 31 |
|
---|
| 32 | struct Time { // private
|
---|
| 33 | uint64_t tv; // nanoseconds since UNIX epoch
|
---|
| 34 | }; // Time
|
---|
| 35 |
|
---|
| 36 | static inline void ?{}( Time & t ) with( t ) { tv = 0; } // fast
|
---|
| 37 | void ?{}( Time & time, int year, int month = 0, int day = 0, int hour = 0, int min = 0, int sec = 0, int nsec = 0 ); // slow
|
---|
| 38 | static inline void ?{}( Time & t, zero_t ) { t.tv = 0; }
|
---|
| 39 |
|
---|
| 40 | // Local Variables: //
|
---|
| 41 | // mode: c //
|
---|
| 42 | // tab-width: 4 //
|
---|
| 43 | // End: //
|
---|
Note:
See
TracBrowser
for help on using the repository browser.