Changeset 4b662f8c in mainline for kernel/generic/src/console/cmd.c


Ignore:
Timestamp:
2007-04-20T18:43:49Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ea63704
Parents:
cc85fb9
Message:

add fancy uptime kconsole command

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/cmd.c

    rcc85fb9 r4b662f8c  
    9393};
    9494
     95static int cmd_uptime(cmd_arg_t *argv);
     96static cmd_info_t uptime_info = {
     97        .name = "uptime",
     98        .description = "Print uptime information.",
     99        .func = cmd_uptime,
     100        .argc = 0
     101};
     102
    95103static int cmd_continue(cmd_arg_t *argv);
    96104static cmd_info_t continue_info = {
     
    440448        &exit_info,
    441449        &reboot_info,
     450        &uptime_info,
    442451        &halt_info,
    443452        &help_info,
     
    530539}
    531540
     541
     542/** Print system uptime information.
     543 *
     544 * @param argv Argument vector.
     545 *
     546 * @return 0 on failure, 1 on success.
     547 */
     548int cmd_uptime(cmd_arg_t *argv)
     549{
     550        ASSERT(uptime);
     551       
     552        /* This doesn't have to be very accurate */
     553        unative_t sec = uptime->seconds1;
     554       
     555        printf("Up %u days, %u hours, %u minutes, %u seconds\n",
     556                sec / 86400, (sec % 86400) / 3600, (sec % 3600) / 60, sec % 60);
     557       
     558        return 1;
     559}
     560
    532561/** Describe specified command.
    533562 *
Note: See TracChangeset for help on using the changeset viewer.