Changeset 7030dab for tests/time.cfa
- Timestamp:
- Apr 6, 2020, 4:46:28 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- e3bc51c
- Parents:
- 71d6bd8 (diff), 057298e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/time.cfa
r71d6bd8 r7030dab 10 10 // Created On : Tue Mar 27 17:24:56 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 20 23:09:21 201813 // Update Count : 2312 // Last Modified On : Sun Jan 5 18:27:37 2020 13 // Update Count : 34 14 14 // 15 15 … … 20 20 Duration d1 = 3`h, d2 = 2`s, d3 = 3.375`s, d4 = 12`s, d5 = 1`s + 10_000`ns; 21 21 sout | d1 | d2 | d3 | d4 | d5; 22 int i;23 22 d1 = 0; 24 23 sout | d1 | d2 | d3; … … 35 34 sout | t; 36 35 t = t + d1; 37 sout | t | t .tv;36 sout | t | t`ns; 38 37 Time t1 = (timespec){ 104_414, 10_000_000 }; 39 sout | t1 | t1 .tv;40 sout | t - t | t + d5 | t .tv;41 char buf[ 16];38 sout | t1 | t1`ns; 39 sout | t - t | t + d5 | t`ns; 40 char buf[64]; 42 41 sout | "yy/mm/dd" | [t, buf]`ymd | nonl; // shared buf => separate calls 43 42 sout | "mm/dd/yy" | mm_dd_yy( t, buf ) | nonl; … … 46 45 sout | "dd/yy/mm" | [t, buf]`dmy; 47 46 Time t2 = { 2001, 7, 4, 0, 0, 1, 0 }, t3 = (timeval){ 994_219_201 }; 48 sout | t2 | t2 .tv | nl | t3 | t3.tv;47 sout | t2 | t2`ns | nl | t3 | t3`ns; 49 48 sout | nl; 50 49 … … 63 62 sout | "Dividing that by 2 gives" | s / 2 | "seconds"; 64 63 sout | s | "seconds is" | s`h | "hours," | (s % 1`h)`m | "minutes," | (s % 1`m)`s | "seconds"; 64 65 t1 = (Time){ 2020, 1, 5, 9, 0, 0, 100000000000LL }; 66 t2 = (Time){ 1969, 13, 5, 9 }; 67 t3 = (Time){ 1970, 25, 366, 48, 120, -120, 60000000000LL }; 68 strftime( buf, 128, "%Y %b %e %H:%M:%S (GMT)", t1 ); 69 sout | buf; 70 strftime( buf, 128, "%Y %b %e %H:%M:%S (GMT)", t2 ); 71 sout | buf; 72 strftime( buf, 128, "%Y %b %e %H:%M:%S (GMT)", t3 ); 73 sout | buf; 65 74 } // main 66 75
Note:
See TracChangeset
for help on using the changeset viewer.