Changeset 8eb2018 for src/tests/time.c
- Timestamp:
- Apr 1, 2018, 10:26:48 PM (7 years ago)
- 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:
- 1031c7e, 9f652a1
- Parents:
- ce28c7b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/time.c
rce28c7b r8eb2018 10 10 // Created On : Tue Mar 27 17:24:56 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Mar 27 17:27:26201813 // Update Count : 212 // Last Modified On : Sun Apr 1 21:49:51 2018 13 // Update Count : 12 14 14 // 15 15 … … 18 18 19 19 int main() { 20 Duration d1 = 3`h, d2 = 2`s, d3 = 3.07`s, d4 = (timeval){ 12 }, d5 = (timespec){ 1, 10000 };20 Duration d1 = 3`h, d2 = 2`s, d3 = 3.07`s, d4 = 12`s, d5 = 1`s + 10_000`ns; 21 21 sout | d1 | d2 | d3 | d4 | d5 | endl; 22 22 int i; … … 34 34 sout | t | endl; 35 35 t = t + d1; 36 sout | t | t - t | t + d5 | t.tv | endl; 36 sout | t | t.tv | endl; 37 Time t1 = (timespec){ 104_414, 10_000_000 }; 38 sout | t1 | t1.tv | endl; 39 sout | t - t | t + d5 | t.tv | endl; 37 40 char buf[16]; 38 41 sout | "yy/mm/dd" | [t, buf]`ymd; // shared buf => separate calls … … 41 44 sout | "mm/dd/yy" | buf; 42 45 sout | "dd/yy/mm" | [t, buf]`dmy | endl; 43 Time c = { 2001, 7, 4, 0, 0, 1, 0};44 sout | c | c.tv | endl;46 Time t2 = { 2001, 7, 4, 0, 0, 1, 0 }, t3 = (timeval){ 994_219_201 }; 47 sout | t2 | t2.tv | endl | t3 | t3.tv | endl; 45 48 sout | endl; 46 49
Note: See TracChangeset
for help on using the changeset viewer.