Changeset 8eb2018 for src/tests/time.c


Ignore:
Timestamp:
Apr 1, 2018, 10:26:48 PM (7 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:
1031c7e, 9f652a1
Parents:
ce28c7b
Message:

cleanup, remove conversion of timeval/timespec to duration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/time.c

    rce28c7b r8eb2018  
    1010// Created On       : Tue Mar 27 17:24:56 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 27 17:27:26 2018
    13 // Update Count     : 2
     12// Last Modified On : Sun Apr  1 21:49:51 2018
     13// Update Count     : 12
    1414//
    1515
     
    1818
    1919int 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;
    2121        sout | d1 | d2 | d3 | d4 | d5 | endl;
    2222        int i;
     
    3434        sout | t | endl;
    3535        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;
    3740        char buf[16];
    3841        sout | "yy/mm/dd" | [t, buf]`ymd;                                       // shared buf => separate calls
     
    4144        sout | "mm/dd/yy" | buf;
    4245        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;
    4548        sout | endl;
    4649
Note: See TracChangeset for help on using the changeset viewer.