Changeset bd41ac52 in mainline for uspace/app/testread/testread.c


Ignore:
Timestamp:
2018-08-25T22:21:25Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cca80a2
Parents:
e2625b1a
Message:

Get rid of sys/time.h

This commit moves the POSIX-like time functionality from libc's
sys/time.h to libposix and introduces C11-like or HelenOS-specific
interfaces to libc.

Specifically, use of sys/time.h, struct timeval, suseconds_t and
gettimeofday is replaced by time.h (C11), struct timespec (C11), usec_t
(HelenOS) and getuptime / getrealtime (HelenOS).

Also attempt to fix the implementation of clock() to return microseconds
(clocks) rather than processor cycles and move it to libc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/testread/testread.c

    re2625b1a rbd41ac52  
    126126        next_mark = 0;
    127127        last_mark = 0;
    128         struct timeval prev_time;
    129         struct timeval start_time;
    130         gettimeofday(&start_time, NULL);
     128        struct timespec prev_time;
     129        struct timespec start_time;
     130        getuptime(&start_time);
    131131        prev_time = start_time;
    132132
     
    152152
    153153                if (progress && offset >= next_mark) {
    154                         struct timeval cur_time;
    155                         gettimeofday(&cur_time, NULL);
     154                        struct timespec cur_time;
     155                        getuptime(&cur_time);
    156156
    157157                        uint32_t last_run = cur_time.tv_sec - prev_time.tv_sec;
     
    170170        }
    171171
    172         struct timeval final_time;
    173         gettimeofday(&final_time, NULL);
     172        struct timespec final_time;
     173        getuptime(&final_time);
    174174
    175175        uint32_t total_run_time = final_time.tv_sec - start_time.tv_sec;
Note: See TracChangeset for help on using the changeset viewer.