Changeset e0c235c for tests


Ignore:
Timestamp:
Jan 5, 2020, 9:31:00 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
4834563
Parents:
3c67255
Message:

move clock.hfa into time.hfa, add getCPUTime, rename duration and time field to "tn", update mktime code

Location:
tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tests/.expect/time.txt

    r3c67255 re0c235c  
    1818Dividing that by 2 gives 2403.5 seconds
    19194807 seconds is 1 hours, 20 minutes, 7 seconds
     202020 Jan  5 14:01:40 (GMT)
     211970 Jan  5 14:00:00 (GMT)
     221973 Jan  2 06:59:00 (GMT)
  • tests/time.cfa

    r3c67255 re0c235c  
    1010// Created On       : Tue Mar 27 17:24:56 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Nov 29 23:05:30 2019
    13 // Update Count     : 24
     12// Last Modified On : Sun Jan  5 18:27:37 2020
     13// Update Count     : 34
    1414//
    1515
     
    3434        sout | t;
    3535        t = t + d1;
    36         sout | t | t.tv;
     36        sout | t | t`ns;
    3737        Time t1 = (timespec){ 104_414, 10_000_000 };
    38         sout | t1 | t1.tv;
    39         sout | t - t  | t + d5 | t.tv;
    40         char buf[16];
     38        sout | t1 | t1`ns;
     39        sout | t - t  | t + d5 | t`ns;
     40        char buf[64];
    4141        sout | "yy/mm/dd" | [t, buf]`ymd | nonl;                        // shared buf => separate calls
    4242        sout | "mm/dd/yy" | mm_dd_yy( t, buf ) | nonl;
     
    4545        sout | "dd/yy/mm" | [t, buf]`dmy;
    4646        Time t2 = { 2001, 7, 4, 0, 0, 1, 0 }, t3 = (timeval){ 994_219_201 };
    47         sout | t2 | t2.tv | nl | t3 | t3.tv;
     47        sout | t2 | t2`ns | nl | t3 | t3`ns;
    4848        sout | nl;
    4949
     
    6262        sout | "Dividing that by 2 gives" | s / 2 | "seconds";
    6363        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;
    6474} // main
    6575
Note: See TracChangeset for help on using the changeset viewer.