Changeset bd41ac52 in mainline for uspace/app/top/screen.c


Ignore:
Timestamp:
2018-08-25T22:21:25Z (6 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/top/screen.c

    re2625b1a rbd41ac52  
    4949#include "top.h"
    5050
    51 #define USEC_COUNT  1000000
    52 
    53 static suseconds_t timeleft = 0;
     51static usec_t timeleft = 0;
    5452
    5553console_ctrl_t *console;
     
    5755static sysarg_t warning_col = 0;
    5856static sysarg_t warning_row = 0;
    59 static suseconds_t warning_timeleft = 0;
     57static usec_t warning_timeleft = 0;
    6058static char *warning_text = NULL;
    6159
     
    179177static inline void print_global_head(data_t *data)
    180178{
    181         printf("top - %02lu:%02lu:%02lu up "
     179        printf("top - %02lld:%02lld:%02lld up "
    182180            "%" PRIun " days, %02" PRIun ":%02" PRIun ":%02" PRIun ", "
    183181            "load average:",
     
    527525        va_end(args);
    528526
    529         warning_timeleft = 2 * USEC_COUNT;
     527        warning_timeleft = SEC2USEC(2);
    530528
    531529        screen_moveto(warning_col, warning_row);
     
    537535 *
    538536 */
    539 int tgetchar(unsigned int sec)
     537int tgetchar(sec_t sec)
    540538{
    541539        /*
     
    544542
    545543        if (timeleft <= 0)
    546                 timeleft = sec * USEC_COUNT;
     544                timeleft = SEC2USEC(sec);
    547545
    548546        /*
Note: See TracChangeset for help on using the changeset viewer.