Uptime

## Uptime Uptime |

## Synopsis

    #include <glibtop/uptime.h>

    #define             GLIBTOP_UPTIME_UPTIME
    #define             GLIBTOP_UPTIME_IDLETIME
    #define             GLIBTOP_UPTIME_BOOT_TIME
    #define             GLIBTOP_MAX_UPTIME
    struct              glibtop_uptime;
    void                glibtop_get_uptime                  (glibtop_uptime *buf);
    #define             glibtop_get_uptime_r
    void                glibtop_get_uptime_l                (glibtop *server,
                                                             glibtop_uptime *buf);
    void                glibtop_get_uptime_p                (glibtop *server,
                                                             glibtop_uptime *buf);
    void                glibtop_get_uptime_s                (glibtop *server,
                                                             glibtop_uptime *buf);

## Description

## Details

### GLIBTOP_UPTIME_UPTIME

    #define GLIBTOP_UPTIME_UPTIME		0

### GLIBTOP_UPTIME_IDLETIME

    #define GLIBTOP_UPTIME_IDLETIME		1

### GLIBTOP_UPTIME_BOOT_TIME

    #define GLIBTOP_UPTIME_BOOT_TIME    2

### GLIBTOP_MAX_UPTIME

    #define GLIBTOP_MAX_UPTIME		3

### struct glibtop_uptime

    struct glibtop_uptime {
    	guint64 flags;
    	double uptime;		/* GLIBTOP_UPTIME_UPTIME */
    	double idletime; /* GLIBTOP_UPTIME_IDLETIME */
    	guint64 boot_time;
    };

### glibtop_get_uptime ()

    void                glibtop_get_uptime                  (glibtop_uptime *buf);

When porting LibGTop to a new system, you only need to implement uptime and idletime if there's a faster or better way to obtain them as using function(glibtop_cpu) for it. Look at `sysdeps/freebsd/uptime.c` for an example on how to obtain them using function(glibtop_cpu).

`buf` : | A location to return the system uptime

### glibtop_get_uptime_r

    #define glibtop_get_uptime_r		glibtop_get_uptime_p

### glibtop_get_uptime_l ()

    void                glibtop_get_uptime_l                (glibtop *server,
                                                             glibtop_uptime *buf);

### glibtop_get_uptime_p ()

    void                glibtop_get_uptime_p                (glibtop *server,
                                                             glibtop_uptime *buf);

### glibtop_get_uptime_s ()

    void                glibtop_get_uptime_s                (glibtop *server,
                                                             glibtop_uptime *buf);