Changeset 1ab8539 in mainline for uspace/app/top/top.c


Ignore:
Timestamp:
2014-11-14T19:16:23Z (9 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5042706
Parents:
9696b01
Message:

remove system.uptime sysinfo entry since it is redundant
cleanup the time handling routines

  • still more cleanup is needed here, the code is a wild combination of quasi-POSIX API (with all the brain-dead types, etc.) and HelenOS API
File:
1 edited

Legend:

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

    r9696b01 r1ab8539  
    156156        /* Get current time */
    157157        struct timeval time;
    158         if (gettimeofday(&time, NULL) != EOK)
    159                 return "Cannot get time of day";
     158        gettimeofday(&time, NULL);
    160159       
    161160        target->hours = (time.tv_sec % DAY) / HOUR;
     
    164163       
    165164        /* Get uptime */
    166         sysarg_t uptime = stats_get_uptime();
    167         target->udays = uptime / DAY;
    168         target->uhours = (uptime % DAY) / HOUR;
    169         target->uminutes = (uptime % HOUR) / MINUTE;
    170         target->useconds = uptime % MINUTE;
     165        struct timeval uptime;
     166        getuptime(&uptime);
     167       
     168        target->udays = uptime.tv_sec / DAY;
     169        target->uhours = (uptime.tv_sec % DAY) / HOUR;
     170        target->uminutes = (uptime.tv_sec % HOUR) / MINUTE;
     171        target->useconds = uptime.tv_sec % MINUTE;
    171172       
    172173        /* Get load */
Note: See TracChangeset for help on using the changeset viewer.