Changeset 205f1add in mainline for uspace/app/testread/testread.c


Ignore:
Timestamp:
2018-08-23T21:14:56Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Children:
f33c989e
Parents:
e2625b1a
git-author:
Jakub Jermar <jakub@…> (2018-08-21 21:58:52)
git-committer:
Jakub Jermar <jakub@…> (2018-08-23 21:14:56)
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 C99-like or HelenOS-specific
interfaces to libc.

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

File:
1 edited

Legend:

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

    re2625b1a r205f1add  
    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.